From bb0ceb6264fa1aea6e68e07cb13cd9a88473febb Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 9 Aug 2008 16:00:12 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- t/t7201-co.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 't/t7201-co.sh') 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 ' ' + 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 -- cgit v1.2.1