aboutsummaryrefslogtreecommitdiff
path: root/t/t7201-co.sh
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2008-02-19 11:24:37 -0500
committerJunio C Hamano <gitster@pobox.com>2008-02-19 21:17:45 -0800
commit9ed36cfa35cfbd09c454f12194a91cd50ba284d1 (patch)
treedb9d61a4a4e47cf8fe6f442f1c46f1d6cce09ae4 /t/t7201-co.sh
parent569012bf91ddb25220483e8912e079ce8a501525 (diff)
downloadgit-9ed36cfa35cfbd09c454f12194a91cd50ba284d1.tar.gz
git-9ed36cfa35cfbd09c454f12194a91cd50ba284d1.tar.xz
branch: optionally setup branch.*.merge from upstream local branches
"git branch" and "git checkout -b" now honor --track option even when the upstream branch is local. Previously --track was silently ignored when forking from a local branch. Also the command did not error out when --track was explicitly asked for but the forked point specified was not an existing branch (i.e. when there is no way to set up the tracking configuration), but now it correctly does. The configuration setting branch.autosetupmerge can now be set to "always", which is equivalent to using --track from the command line. Setting branch.autosetupmerge to "true" will retain the former behavior of only setting up branch.*.merge for remote upstream branches. Includes test cases for the new functionality. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7201-co.sh')
-rwxr-xr-xt/t7201-co.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 5492f21c7..17cff8d51 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -263,4 +263,28 @@ test_expect_success 'checkout with ambiguous tag/branch names' '
'
+test_expect_success \
+ 'checkout w/--track sets up tracking' '
+ git config branch.autosetupmerge false &&
+ git checkout master &&
+ git checkout --track -b track1 &&
+ test "$(git config branch.track1.remote)" &&
+ test "$(git config branch.track1.merge)"'
+
+test_expect_success \
+ 'checkout w/autosetupmerge=always sets up tracking' '
+ git config branch.autosetupmerge always &&
+ git checkout master &&
+ git checkout -b track2 &&
+ test "$(git config branch.track2.remote)" &&
+ test "$(git config branch.track2.merge)"
+ git config branch.autosetupmerge false'
+
+test_expect_success \
+ 'checkout w/--track from non-branch HEAD fails' '
+ git checkout -b delete-me master &&
+ rm .git/refs/heads/delete-me &&
+ test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&
+ !(git checkout --track -b track)'
+
test_done