]> git.ipfire.org Git - thirdparty/git.git/commit - t/t2027-checkout-track.sh
checkout: add tests for -b and --track
authorRené Scharfe <l.s.r@web.de>
Sun, 24 May 2020 07:22:51 +0000 (09:22 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 May 2020 23:19:41 +0000 (16:19 -0700)
commit16ab794b8257dd08906994d5cccacfa3886aa543
treeec26962828f670b65ceccfe637ee6a4558a0331d
parentae92ac8ae3838e72840f5d019195bb9c0c9e7b0e
checkout: add tests for -b and --track

Test git checkout -b with and without --track and demonstrate unexpected
error messages when it's given an extra (i.e. unsupported) path
argument.  In both cases it reports:

   $ git checkout -b foo origin/master bar
   fatal: 'bar' is not a commit and a branch 'foo' cannot be created from it

The problem is that the start point we gave for the new branch is
"origin/master" and "bar" is just some extra argument -- it could even
be a valid commit, which would make the message even more confusing.  We
have more fitting error messages in git commit, but get confused; use
the text of the rights ones in the tests.

Reported-by: Dana Dahlstrom <dahlstrom@google.com>
Original-test-by: Jeff King <peff@peff.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t2018-checkout-branch.sh
t/t2027-checkout-track.sh [new file with mode: 0755]