Commit graph

3 commits

Author SHA1 Message Date
Junio C Hamano 3749fde561 test: use $_z40 from test-lib
There is no need to duplicate the definition of $_z40 and $_x40 that
test-lib.sh supplies the test scripts.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-23 22:34:43 -07:00
Junio C Hamano 3442ea4a75 git checkout: do not allow switching to a tree-ish that is not a commit
"git checkout -b newbranch $commit^{tree}" mistakenly created a new branch
rooted at the current HEAD, because in that case, the two structure fields
used to see if the command was invoked without any argument (hence it
needs to default to checking out the HEAD) were populated incorrectly.

Upon seeing a command line argument that we took as a rev, we should store
that string in new.name, even if that does not name a commit.  This will
correctly trigger the existing safety logic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
2009-01-03 13:34:19 -08:00
Alexandre Julliard 323e00fd46 checkout: Don't crash when switching away from an invalid branch.
When using alternates, it is possible for HEAD to end up pointing to
an invalid commit. git checkout should be able to recover from that
situation without crashing.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-09 10:11:39 -08:00