{"action":"created","comment":{"url":"https://api.github.com/repos/repotag/rjgit/pulls/comments/51624655","id":51624655,"diff_hunk":"@@ -154,175 +154,202 @@\n       result = @repo.git.merge(commit)\n       expect(result).to include('materialist.txt')\n     end\n-    \n+\n     after(:each) do\n       remove_temp_repo(@temp_repo_path)\n     end\n-    \n+\n   end\n-  \n+\n   context \"cloning a non-bare repository\" do\n     before(:each) do\n-      @repo = Repo.new(TEST_REPO_PATH) \n+      @repo = Repo.new(TEST_REPO_PATH)\n       @remote = TEST_REPO_PATH\n       @local  = get_new_temp_repo_path\n     end\n-    \n+\n     it \"creates a new local repository\" do\n       clone = @repo.git.clone(@remote, @local)\n       expect(clone.path).to eq File.join(@local, '/.git')\n       expect(File.exist?(File.join(@local, 'homer-excited.png'))).to be true\n     end\n-    \n+\n     it \"clones a specific branch if specified\" do\n       clone = @repo.git.clone(@remote, @local, {branch: 'refs/heads/alternative'})\n       expect(clone.branches).to have_exactly(1).branch\n       expect(clone.branches.first).to eq 'refs/heads/alternative'\n     end\n-    \n+\n     it \"clones all branches if specified\" do\n       clone = @repo.git.clone(@remote, @local, {branch: :all})\n       expect(clone.branches).to have_at_least(1).branch\n-      \n+\n       skip \"This specs fails because of a JGit bug with CloneCommand#set_clone_all_branches(true)\"\n     end\n-    \n+\n     it \"clones with credentials\" do\n       clone = @repo.git.clone(@remote, @local, username: 'rspec', password: 'Hahmeid7')\n       expect(clone.path).to eq File.join(@local, '/.git')\n       expect(File.exist?(File.join(@local, 'homer-excited.png'))).to be true\n     end\n-    \n+\n     after(:each) do\n       remove_temp_repo(@local)\n     end\n-    \n+\n   end\n-  \n+\n   context \"cloning a bare repository\" do\n     before(:each) do\n       remote = TEST_BARE_REPO_PATH\n       @local  = get_new_temp_repo_path(true)\n       @clone = RubyGit.clone(remote, @local, is_bare: true)\n     end\n-    \n+\n     it \"is be bare\" do\n       expect(@clone).to be_bare\n     end\n-    \n+\n     after(:each) do\n       remove_temp_repo(@local)\n     end\n   end\n-  \n+\n   context \"patching\" do\n     before(:each) do\n       @temp_repo_path = create_temp_repo(TEST_REPO_PATH)\n       @repo = Repo.new(@temp_repo_path)\n     end\n-    \n+\n     it \"applies a patch from a String\" do\n       patch = fixture('postpatriarchialist.patch')\n       result = @repo.git.apply_patch(patch)\n       expect(result).to have(1).changed_file\n       expect(result.first).to match /postpatriarchialist.txt/\n     end\n-    \n+\n     it \"applies a patch from a file\" do\n       patch = File.join(File.dirname(__FILE__), 'fixtures', 'postpatriarchialist.patch')\n       result = @repo.git.apply_file(patch)\n       expect(result).to have(1).changed_file\n       expect(result.first).to match /postpatriarchialist.txt/\n     end\n-    \n+\n     after(:each) do\n       remove_temp_repo(@temp_repo_path)\n     end\n-    \n+\n   end\n-  \n-  describe \"push and pull\" do \n+\n+  describe \"push, pull and fetch\" do\n     before(:each) do\n       @temp_repo_path = create_temp_repo(TEST_REPO_PATH)\n       @remote = Repo.new(@temp_repo_path)\n       @local = @remote.git.clone(@remote.path, get_new_temp_repo_path)\n     end\n-    \n+\n     context \"pulling from another repository\" do\n       before(:each) do\n         File.open(File.join(@remote.path, \"materialist.txt\"), 'a') {|file| file.write(\"\\n Beautiful materialist.\") }\n         @remote.add(\"materialist.txt\")\n         @commit = @remote.commit(\"Making a change for pushing and pulling specs\")\n       end\n-    \n+\n       it \"pulls commits from a local clone\" do\n         expect(@local.commits).to have(8).commits\n         @local.git.pull(\"origin\", \"master\")\n         expect(@local.commits).to have(9).commits\n       end\n-      \n+\n       it \"pulls commits from a local clone with rebase\" do\n         expect(@local.commits).to have(8).commits\n         @local.git.pull(nil, nil, rebase: true)\n         expect(@local.commits).to have(9).commits\n       end\n-    \n+\n       it \"pulls commits from a local clone with credentials\" do\n         expect(@local.commits).to have(8).commits\n         @local.git.pull(nil, nil, username: 'rspec', password: 'Hahmeid7')\n         expect(@local.commits).to have(9).commits\n       end\n-    \n+\n+    end\n+\n+    context \"fetching from another repository\" do\n+      before(:each) do\n+        @remote.create_branch('a_new_branch')\n+        @remote.checkout('a_new_branch')\n+        File.open(File.join(@remote.path, \"materialist.txt\"), 'a') {|file| file.write(\"\\n Beautiful materialist.\") }\n+        @remote.add(\"materialist.txt\")\n+        @commit = @remote.commit(\"Making a change for fetching specs\")\n+        @remote.git.tag('a_new_tag')\n+      end\n+\n+      it \"fetches from a local clone\" do\n+        expect(@local.branches).to have(1).branches\n+        expect(@local.tags).to have(0).tags\n+        @local.git.fetch(@remote.path, refspecs: \"+refs/*:refs/*\")\n+        expect(@local.branches).to have(3).branches","path":"spec/git_spec.rb","position":306,"original_position":306,"commit_id":"d1b8819817d6bea87af854cd1f8fea9afc219f88","original_commit_id":"d1b8819817d6bea87af854cd1f8fea9afc219f88","user":{"login":"bartkamphorst","id":571173,"avatar_url":"https://avatars.githubusercontent.com/u/571173?v=3","gravatar_id":"","url":"https://api.github.com/users/bartkamphorst","html_url":"https://github.com/bartkamphorst","followers_url":"https://api.github.com/users/bartkamphorst/followers","following_url":"https://api.github.com/users/bartkamphorst/following{/other_user}","gists_url":"https://api.github.com/users/bartkamphorst/gists{/gist_id}","starred_url":"https://api.github.com/users/bartkamphorst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartkamphorst/subscriptions","organizations_url":"https://api.github.com/users/bartkamphorst/orgs","repos_url":"https://api.github.com/users/bartkamphorst/repos","events_url":"https://api.github.com/users/bartkamphorst/events{/privacy}","received_events_url":"https://api.github.com/users/bartkamphorst/received_events","type":"User","site_admin":false},"body":"Ah, yes, that makes sense, thanks. I had forgotten about the alternative branch in the remote.\r\n> I could also not create a new branch, and just use alternative and expect 2.\r\n\r\nWould be my preference, as it simplifies the test. But as you say, it would be good to have a comment there to explain that `@remote` already has a second branch.","created_at":"2016-02-02T19:51:49Z","updated_at":"2016-02-02T19:51:49Z","html_url":"https://github.com/repotag/rjgit/pull/26#discussion_r51624655","pull_request_url":"https://api.github.com/repos/repotag/rjgit/pulls/26","_links":{"self":{"href":"https://api.github.com/repos/repotag/rjgit/pulls/comments/51624655"},"html":{"href":"https://github.com/repotag/rjgit/pull/26#discussion_r51624655"},"pull_request":{"href":"https://api.github.com/repos/repotag/rjgit/pulls/26"}}},"pull_request":{"url":"https://api.github.com/repos/repotag/rjgit/pulls/26","id":57428122,"html_url":"https://github.com/repotag/rjgit/pull/26","diff_url":"https://github.com/repotag/rjgit/pull/26.diff","patch_url":"https://github.com/repotag/rjgit/pull/26.patch","issue_url":"https://api.github.com/repos/repotag/rjgit/issues/26","number":26,"state":"open","locked":false,"title":"Add fetch to git","user":{"login":"andersonmills","id":5975010,"avatar_url":"https://avatars.githubusercontent.com/u/5975010?v=3","gravatar_id":"","url":"https://api.github.com/users/andersonmills","html_url":"https://github.com/andersonmills","followers_url":"https://api.github.com/users/andersonmills/followers","following_url":"https://api.github.com/users/andersonmills/following{/other_user}","gists_url":"https://api.github.com/users/andersonmills/gists{/gist_id}","starred_url":"https://api.github.com/users/andersonmills/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersonmills/subscriptions","organizations_url":"https://api.github.com/users/andersonmills/orgs","repos_url":"https://api.github.com/users/andersonmills/repos","events_url":"https://api.github.com/users/andersonmills/events{/privacy}","received_events_url":"https://api.github.com/users/andersonmills/received_events","type":"User","site_admin":false},"body":"With this commit, a fetch command is added to git.rb.","created_at":"2016-01-27T21:48:01Z","updated_at":"2016-02-02T19:51:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e53da6d647496aabfa6a35ab3616c84d1e06cbb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/repotag/rjgit/pulls/26/commits","review_comments_url":"https://api.github.com/repos/repotag/rjgit/pulls/26/comments","review_comment_url":"https://api.github.com/repos/repotag/rjgit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/repotag/rjgit/issues/26/comments","statuses_url":"https://api.github.com/repos/repotag/rjgit/statuses/d1b8819817d6bea87af854cd1f8fea9afc219f88","head":{"label":"andersonmills:add_fetch_to_git","ref":"add_fetch_to_git","sha":"d1b8819817d6bea87af854cd1f8fea9afc219f88","user":{"login":"andersonmills","id":5975010,"avatar_url":"https://avatars.githubusercontent.com/u/5975010?v=3","gravatar_id":"","url":"https://api.github.com/users/andersonmills","html_url":"https://github.com/andersonmills","followers_url":"https://api.github.com/users/andersonmills/followers","following_url":"https://api.github.com/users/andersonmills/following{/other_user}","gists_url":"https://api.github.com/users/andersonmills/gists{/gist_id}","starred_url":"https://api.github.com/users/andersonmills/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersonmills/subscriptions","organizations_url":"https://api.github.com/users/andersonmills/orgs","repos_url":"https://api.github.com/users/andersonmills/repos","events_url":"https://api.github.com/users/andersonmills/events{/privacy}","received_events_url":"https://api.github.com/users/andersonmills/received_events","type":"User","site_admin":false},"repo":{"id":49390623,"name":"rjgit","full_name":"andersonmills/rjgit","owner":{"login":"andersonmills","id":5975010,"avatar_url":"https://avatars.githubusercontent.com/u/5975010?v=3","gravatar_id":"","url":"https://api.github.com/users/andersonmills","html_url":"https://github.com/andersonmills","followers_url":"https://api.github.com/users/andersonmills/followers","following_url":"https://api.github.com/users/andersonmills/following{/other_user}","gists_url":"https://api.github.com/users/andersonmills/gists{/gist_id}","starred_url":"https://api.github.com/users/andersonmills/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersonmills/subscriptions","organizations_url":"https://api.github.com/users/andersonmills/orgs","repos_url":"https://api.github.com/users/andersonmills/repos","events_url":"https://api.github.com/users/andersonmills/events{/privacy}","received_events_url":"https://api.github.com/users/andersonmills/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andersonmills/rjgit","description":"A JRuby wrapper around the JGit library for manipulating Git repositories, the Ruby way.","fork":true,"url":"https://api.github.com/repos/andersonmills/rjgit","forks_url":"https://api.github.com/repos/andersonmills/rjgit/forks","keys_url":"https://api.github.com/repos/andersonmills/rjgit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andersonmills/rjgit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andersonmills/rjgit/teams","hooks_url":"https://api.github.com/repos/andersonmills/rjgit/hooks","issue_events_url":"https://api.github.com/repos/andersonmills/rjgit/issues/events{/number}","events_url":"https://api.github.com/repos/andersonmills/rjgit/events","assignees_url":"https://api.github.com/repos/andersonmills/rjgit/assignees{/user}","branches_url":"https://api.github.com/repos/andersonmills/rjgit/branches{/branch}","tags_url":"https://api.github.com/repos/andersonmills/rjgit/tags","blobs_url":"https://api.github.com/repos/andersonmills/rjgit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andersonmills/rjgit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andersonmills/rjgit/git/refs{/sha}","trees_url":"https://api.github.com/repos/andersonmills/rjgit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andersonmills/rjgit/statuses/{sha}","languages_url":"https://api.github.com/repos/andersonmills/rjgit/languages","stargazers_url":"https://api.github.com/repos/andersonmills/rjgit/stargazers","contributors_url":"https://api.github.com/repos/andersonmills/rjgit/contributors","subscribers_url":"https://api.github.com/repos/andersonmills/rjgit/subscribers","subscription_url":"https://api.github.com/repos/andersonmills/rjgit/subscription","commits_url":"https://api.github.com/repos/andersonmills/rjgit/commits{/sha}","git_commits_url":"https://api.github.com/repos/andersonmills/rjgit/git/commits{/sha}","comments_url":"https://api.github.com/repos/andersonmills/rjgit/comments{/number}","issue_comment_url":"https://api.github.com/repos/andersonmills/rjgit/issues/comments{/number}","contents_url":"https://api.github.com/repos/andersonmills/rjgit/contents/{+path}","compare_url":"https://api.github.com/repos/andersonmills/rjgit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andersonmills/rjgit/merges","archive_url":"https://api.github.com/repos/andersonmills/rjgit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andersonmills/rjgit/downloads","issues_url":"https://api.github.com/repos/andersonmills/rjgit/issues{/number}","pulls_url":"https://api.github.com/repos/andersonmills/rjgit/pulls{/number}","milestones_url":"https://api.github.com/repos/andersonmills/rjgit/milestones{/number}","notifications_url":"https://api.github.com/repos/andersonmills/rjgit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andersonmills/rjgit/labels{/name}","releases_url":"https://api.github.com/repos/andersonmills/rjgit/releases{/id}","deployments_url":"https://api.github.com/repos/andersonmills/rjgit/deployments","created_at":"2016-01-10T23:32:46Z","updated_at":"2016-01-29T18:22:07Z","pushed_at":"2016-02-02T18:28:08Z","git_url":"git://github.com/andersonmills/rjgit.git","ssh_url":"git@github.com:andersonmills/rjgit.git","clone_url":"https://github.com/andersonmills/rjgit.git","svn_url":"https://github.com/andersonmills/rjgit","homepage":"","size":33543,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"repotag:master","ref":"master","sha":"56b2a2ffa2e3a64f85efad3157cec997024bfc6b","user":{"login":"repotag","id":4007489,"avatar_url":"https://avatars.githubusercontent.com/u/4007489?v=3","gravatar_id":"","url":"https://api.github.com/users/repotag","html_url":"https://github.com/repotag","followers_url":"https://api.github.com/users/repotag/followers","following_url":"https://api.github.com/users/repotag/following{/other_user}","gists_url":"https://api.github.com/users/repotag/gists{/gist_id}","starred_url":"https://api.github.com/users/repotag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/repotag/subscriptions","organizations_url":"https://api.github.com/users/repotag/orgs","repos_url":"https://api.github.com/users/repotag/repos","events_url":"https://api.github.com/users/repotag/events{/privacy}","received_events_url":"https://api.github.com/users/repotag/received_events","type":"Organization","site_admin":false},"repo":{"id":9103531,"name":"rjgit","full_name":"repotag/rjgit","owner":{"login":"repotag","id":4007489,"avatar_url":"https://avatars.githubusercontent.com/u/4007489?v=3","gravatar_id":"","url":"https://api.github.com/users/repotag","html_url":"https://github.com/repotag","followers_url":"https://api.github.com/users/repotag/followers","following_url":"https://api.github.com/users/repotag/following{/other_user}","gists_url":"https://api.github.com/users/repotag/gists{/gist_id}","starred_url":"https://api.github.com/users/repotag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/repotag/subscriptions","organizations_url":"https://api.github.com/users/repotag/orgs","repos_url":"https://api.github.com/users/repotag/repos","events_url":"https://api.github.com/users/repotag/events{/privacy}","received_events_url":"https://api.github.com/users/repotag/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/repotag/rjgit","description":"A JRuby wrapper around the JGit library for manipulating Git repositories, the Ruby way.","fork":false,"url":"https://api.github.com/repos/repotag/rjgit","forks_url":"https://api.github.com/repos/repotag/rjgit/forks","keys_url":"https://api.github.com/repos/repotag/rjgit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/repotag/rjgit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/repotag/rjgit/teams","hooks_url":"https://api.github.com/repos/repotag/rjgit/hooks","issue_events_url":"https://api.github.com/repos/repotag/rjgit/issues/events{/number}","events_url":"https://api.github.com/repos/repotag/rjgit/events","assignees_url":"https://api.github.com/repos/repotag/rjgit/assignees{/user}","branches_url":"https://api.github.com/repos/repotag/rjgit/branches{/branch}","tags_url":"https://api.github.com/repos/repotag/rjgit/tags","blobs_url":"https://api.github.com/repos/repotag/rjgit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/repotag/rjgit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/repotag/rjgit/git/refs{/sha}","trees_url":"https://api.github.com/repos/repotag/rjgit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/repotag/rjgit/statuses/{sha}","languages_url":"https://api.github.com/repos/repotag/rjgit/languages","stargazers_url":"https://api.github.com/repos/repotag/rjgit/stargazers","contributors_url":"https://api.github.com/repos/repotag/rjgit/contributors","subscribers_url":"https://api.github.com/repos/repotag/rjgit/subscribers","subscription_url":"https://api.github.com/repos/repotag/rjgit/subscription","commits_url":"https://api.github.com/repos/repotag/rjgit/commits{/sha}","git_commits_url":"https://api.github.com/repos/repotag/rjgit/git/commits{/sha}","comments_url":"https://api.github.com/repos/repotag/rjgit/comments{/number}","issue_comment_url":"https://api.github.com/repos/repotag/rjgit/issues/comments{/number}","contents_url":"https://api.github.com/repos/repotag/rjgit/contents/{+path}","compare_url":"https://api.github.com/repos/repotag/rjgit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/repotag/rjgit/merges","archive_url":"https://api.github.com/repos/repotag/rjgit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/repotag/rjgit/downloads","issues_url":"https://api.github.com/repos/repotag/rjgit/issues{/number}","pulls_url":"https://api.github.com/repos/repotag/rjgit/pulls{/number}","milestones_url":"https://api.github.com/repos/repotag/rjgit/milestones{/number}","notifications_url":"https://api.github.com/repos/repotag/rjgit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/repotag/rjgit/labels{/name}","releases_url":"https://api.github.com/repos/repotag/rjgit/releases{/id}","deployments_url":"https://api.github.com/repos/repotag/rjgit/deployments","created_at":"2013-03-29T17:51:29Z","updated_at":"2016-01-25T23:51:01Z","pushed_at":"2016-02-02T08:27:44Z","git_url":"git://github.com/repotag/rjgit.git","ssh_url":"git@github.com:repotag/rjgit.git","clone_url":"https://github.com/repotag/rjgit.git","svn_url":"https://github.com/repotag/rjgit","homepage":"","size":33555,"stargazers_count":23,"watchers_count":23,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":6,"forks":6,"open_issues":6,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/repotag/rjgit/pulls/26"},"html":{"href":"https://github.com/repotag/rjgit/pull/26"},"issue":{"href":"https://api.github.com/repos/repotag/rjgit/issues/26"},"comments":{"href":"https://api.github.com/repos/repotag/rjgit/issues/26/comments"},"review_comments":{"href":"https://api.github.com/repos/repotag/rjgit/pulls/26/comments"},"review_comment":{"href":"https://api.github.com/repos/repotag/rjgit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/repotag/rjgit/pulls/26/commits"},"statuses":{"href":"https://api.github.com/repos/repotag/rjgit/statuses/d1b8819817d6bea87af854cd1f8fea9afc219f88"}}}}