aboutsummaryrefslogtreecommitdiff
path: root/t/t7201-co.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2008-08-09 16:00:12 +0200
committerJunio C Hamano <gitster@pobox.com>2008-08-11 16:37:28 -0700
commitbb0ceb6264fa1aea6e68e07cb13cd9a88473febb (patch)
tree3bb234811f3e3ff627dd73d83e99cf0adfa6eb17 /t/t7201-co.sh
parentac39efbdf3d41443c40166b7578b7fb87c2f3b60 (diff)
downloadgit-bb0ceb6264fa1aea6e68e07cb13cd9a88473febb.tar.gz
git-bb0ceb6264fa1aea6e68e07cb13cd9a88473febb.tar.xz
checkout --track: make up a sensible branch name if '-b' was omitted
What does the user most likely want with this command? $ git checkout --track origin/next Exactly. A branch called 'next', that tracks origin's branch 'next'. Make it so. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7201-co.sh')
-rwxr-xr-xt/t7201-co.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 9ad5d635a..943dd57aa 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -337,4 +337,15 @@ test_expect_success \
test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&
test_must_fail git checkout --track -b track'
+test_expect_success \
+ 'checkout with --track fakes a sensible -b <name>' '
+ git update-ref refs/remotes/origin/koala/bear renamer &&
+ git checkout --track origin/koala/bear &&
+ test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
+ test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"'
+
+test_expect_success \
+ 'checkout with --track, but without -b, fails with too short tracked name' '
+ test_must_fail git checkout --track renamer'
+
test_done