diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2008-08-09 16:00:12 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-11 16:37:28 -0700 |
commit | bb0ceb6264fa1aea6e68e07cb13cd9a88473febb (patch) | |
tree | 3bb234811f3e3ff627dd73d83e99cf0adfa6eb17 /t/t7201-co.sh | |
parent | ac39efbdf3d41443c40166b7578b7fb87c2f3b60 (diff) | |
download | git-bb0ceb6264fa1aea6e68e07cb13cd9a88473febb.tar.gz |
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-x | t/t7201-co.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 9ad5d635a2..943dd57aac 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 |