git-commit-vandalism/builtin
Junio C Hamano 0cb6ad3c3d checkout: fix bug with ambiguous refs
The usual dwim_ref lookup prefers tags to branches. Because
checkout primarily works on branches, though, we switch that
behavior to prefer branches.

However, there was a bug in the implementation in which we
used lookup_commit_reference (which used the regular lookup
rules) to get the actual commit to checkout. Checking out an
ambiguous ref therefore ended up putting us in an extremely
broken state in which we wrote the branch ref into HEAD, but
actually checked out the tree for the tag.

This patch fixes the bug by always attempting to pull the
commit to be checked out from the branch-ified version of
the name we were given.

Patch by Junio, tests and commit message from Jeff King.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-11 13:14:56 -08:00
..
add.c Merge branch 'maint-1.7.1' into maint-1.7.2 2010-12-01 16:40:20 -08:00
annotate.c
apply.c Merge branch 'fc/apply-p2-get-header-name' into maint 2010-12-09 10:36:36 -08:00
archive.c
bisect--helper.c
blame.c Merge branch 'ks/no-textconv-symlink' into maint 2010-12-02 11:26:24 -08:00
branch.c
bundle.c Use angles for placeholders consistently 2010-10-08 12:29:52 -07:00
cat-file.c blame,cat-file --textconv: Don't assume mode is ``S_IFREF | 0664'' 2010-09-29 16:53:25 -07:00
check-attr.c
check-ref-format.c
checkout-index.c Fix {update,checkout}-index usage strings 2010-10-08 12:31:08 -07:00
checkout.c checkout: fix bug with ambiguous refs 2011-01-11 13:14:56 -08:00
clean.c clean: remove redundant variable baselen 2010-11-17 13:26:38 -08:00
clone.c clone: warn users --depth is ignored in local clones 2010-08-24 09:28:02 -07:00
commit-tree.c Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
commit.c commit: die before asking to edit the log message 2010-12-20 17:45:51 -08:00
config.c Merge branch 'jn/paginate-fix' 2010-08-31 16:23:31 -07:00
count-objects.c
describe.c
diff-files.c
diff-index.c
diff-tree.c
diff.c
fast-export.c Merge branch 'en/d-f-conflict-fix' 2010-09-08 08:54:01 -07:00
fetch-pack.c
fetch.c Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
fmt-merge-msg.c Merge branch 'jn/update-contrib-example-merge' 2010-09-03 09:43:42 -07:00
for-each-ref.c for-each-ref: fix objectname:short bug 2010-08-26 16:42:25 -07:00
fsck.c
gc.c
grep.c Use angles for placeholders consistently 2010-10-08 12:29:52 -07:00
hash-object.c
help.c
index-pack.c Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
init-db.c init: plug tiny one-time memory leak 2010-10-06 10:46:05 -07:00
log.c Fix 'git log' early pager startup error case 2010-08-25 12:11:59 -07:00
ls-files.c Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
ls-remote.c ls-remote: run setup_git_directory_gently() sooner 2010-08-15 20:00:02 -07:00
ls-tree.c Use angles for placeholders consistently 2010-10-08 12:29:52 -07:00
mailinfo.c
mailsplit.c Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
merge-base.c merge-base --independent to print reduced parent list in a merge 2010-08-18 14:02:03 -07:00
merge-file.c merge-file: correctly find files when called in subdir 2010-10-18 16:10:57 -07:00
merge-index.c
merge-ours.c
merge-recursive.c Merge branch 'jn/merge-renormalize' 2010-09-03 09:43:41 -07:00
merge-tree.c
merge.c Merge branch 'cb/maint-orphan-merge-noclobber' into maint 2010-12-02 11:27:13 -08:00
mktag.c
mktree.c
mv.c
name-rev.c object.h: Add OBJECT_ARRAY_INIT macro and make use of it. 2010-08-29 22:42:49 -07:00
notes.c notes: Don't create (empty) commit when removing non-existing notes 2010-08-31 11:07:34 -07:00
pack-objects.c make pack-objects a bit more resilient to repo corruption 2010-10-22 14:59:58 -07:00
pack-redundant.c
pack-refs.c
patch-id.c
prune-packed.c
prune.c
push.c Merge branch 'maint' 2010-08-12 18:07:09 -07:00
read-tree.c
receive-pack.c
reflog.c
remote.c Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
replace.c
rerere.c Merge branch 'jn/merge-renormalize' 2010-09-03 09:43:41 -07:00
reset.c reset: suggest what to do upon "git reset --mixed <paths>" 2010-08-21 23:17:35 -07:00
rev-list.c Merge branch 'jk/maint-rev-list-nul' into maint 2010-11-24 12:46:32 -08:00
rev-parse.c
revert.c Merge branch 'jn/cherry-pick-refresh-index' into maint 2010-12-09 10:36:51 -08:00
rm.c
send-pack.c send-pack: avoid redundant "pack-objects died with strange error" 2010-10-18 16:12:09 -07:00
shortlog.c
show-branch.c Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
show-ref.c
stripspace.c
symbolic-ref.c
tag.c tag: factor out sig detection for tag display 2010-11-10 09:40:34 -08:00
tar-tree.c
unpack-file.c
unpack-objects.c do not depend on signed integer overflow 2010-10-06 11:10:07 -07:00
update-index.c Fix {update,checkout}-index usage strings 2010-10-08 12:31:08 -07:00
update-ref.c
update-server-info.c
upload-archive.c
var.c var: run setup_git_directory_gently() sooner 2010-08-15 20:00:02 -07:00
verify-pack.c
verify-tag.c verify-tag: factor out signature detection 2010-11-10 09:39:56 -08:00
write-tree.c