aboutsummaryrefslogtreecommitdiffstats
path: root/commit.c
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2021-01-07 02:36:59 -0800
committerJunio C Hamano <gitster@pobox.com>2021-01-11 14:13:50 -0800
commit6436a20284f33d42103cac93bd82e65bebb31526 (patch)
treecdf5f66dce357743da868af7f898cee3f306f6a7 /commit.c
parentrefs: factor out set_read_ref_cutoffs() (diff)
downloadgit-6436a20284f33d42103cac93bd82e65bebb31526.tar.gz
git-6436a20284f33d42103cac93bd82e65bebb31526.zip
refs: allow @{n} to work with n-sized reflog
This sequence works $ git checkout -b newbranch $ git commit --allow-empty -m one $ git show -s newbranch@{1} and shows the state that was immediately after the newbranch was created. But then if you do $ git reflog expire --expire=now refs/heads/newbranch $ git commit --allow=empty -m two $ git show -s newbranch@{1} you'd be scolded with fatal: log for 'newbranch' only has 1 entries While it is true that it has only 1 entry, we have enough information in that single entry that records the transition between the state in which the tip of the branch was pointing at commit 'one' to the new commit 'two' built on it, so we should be able to answer "what object newbranch was pointing at?". But we refuse to do so. Make @{0} the special case where we use the new side to look up that entry. Otherwise, look up @{n} using the old side of the (n-1)th entry of the reflog. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions
'deletions'>-1/+1 2008-02-03git-p4: Fix an obvious typoTommy Thorn1-1/+1 2008-02-03Let "git svn" run "git gc --auto" occasionallyKarl Hasselström1-0/+12 2008-02-03git-svn: Don't call git-repack anymoreKarl Hasselström1-11/+3 2008-02-03git-p4: Ensure the working directory and the index are clean before "git-p4 r...Simon Hausmann1-0/+5 2008-02-03git-p4: Fix submit user-interface.Simon Hausmann1-59/+26 2008-02-03Remove $Id: ..$ $Header: ..$ etc from +ko and +k files during importJason McMullan1-3/+7 2008-02-03Fix "git-commit -C $tag"Junio C Hamano2-1/+19 2008-02-03Documentation/git-stash.txt: Adjust SYNOPSIS command syntax (2)Jari Aalto1-3/+4