Permalink
Browse files

Merge pull request #1 from sumbach/branch-set-upstream

Use `git branch --set-upstream` instead of `git config`
  • Loading branch information...
2 parents 0599141 + 5af77ce commit 199e8ebd3c431ed11525cd9f86546a35c9be99bb @webmat committed Dec 7, 2011
Showing with 6 additions and 13 deletions.
  1. +2 −9 lib/git_remote_branch.rb
  2. +4 −4 test/functional/grb_test.rb
View
@@ -47,8 +47,7 @@ class NotOnGitRepositoryError < RuntimeError; end
:commands => [
'"#{GIT} push #{origin} #{branch_name}:refs/heads/#{branch_name}"',
'"#{GIT} fetch #{origin}"',
- '"#{GIT} config branch.#{branch_name}.remote #{origin}"',
- '"#{GIT} config branch.#{branch_name}.merge refs/heads/#{branch_name}"',
+ '"#{GIT} branch --set-upstream #{branch_name} #{origin}/#{branch_name}"',
'"#{GIT} checkout #{branch_name}"'
]
},
@@ -80,14 +79,8 @@ class NotOnGitRepositoryError < RuntimeError; end
:description => 'track an existing remote branch',
:aliases => %w{track follow grab fetch},
:commands => [
- # This string programming thing is getting old. Not flexible enough anymore.
'"#{GIT} fetch #{origin}"',
- 'if local_branches.include?(branch_name)
- "#{GIT} config branch.#{branch_name}.remote #{origin}\n" +
- "#{GIT} config branch.#{branch_name}.merge refs/heads/#{branch_name}"
- else
- "#{GIT} branch --track #{branch_name} #{origin}/#{branch_name}"
- end'
+ '"#{GIT} branch --set-upstream #{branch_name} #{origin}/#{branch_name}"'
]
}
} unless defined?(COMMANDS)
@@ -32,8 +32,8 @@ class GRBTest < Test::Unit::TestCase
should_have_branch 'new_branch', :local, :remote
- should "use the branch --track command" do
- assert_match %r{branch --track}, @output
+ should "use the branch --set-upstream command" do
+ assert_match %r{branch --set-upstream}, @output
end
end
@@ -45,8 +45,8 @@ class GRBTest < Test::Unit::TestCase
should_have_branch 'new_branch', :local, :remote
- should "use git config to connect the branches" do
- assert_match %r{git\sconfig}, @output
+ should "use the branch --set-upstream command" do
+ assert_match %r{branch --set-upstream}, @output
end
end
end

0 comments on commit 199e8eb

Please sign in to comment.