]> git.ipfire.org Git - thirdparty/git.git/commit - sha1-name.c
interpret_nth_last_branch(): avoid traversing the reflog twice
authorJunio C Hamano <gitster@pobox.com>
Mon, 19 Jan 2009 08:04:25 +0000 (00:04 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 19 Jan 2009 23:35:21 +0000 (15:35 -0800)
commitc2883e62f5b9980e5402431f2261c961354d0f15
treebe6de693adb7e9b21e95e9409dc06a7d341d9133
parent696acf45f9638b014c7132508de26d1a571c8a33
interpret_nth_last_branch(): avoid traversing the reflog twice

You can have quite a many reflog entries, but you typically won't recall
which branch you were on after switching branches for more than several
times.

Instead of reading the reflog twice, this reads the branch switching event
and keeps as many entries as the user asked from the latest such entries,
which is the minimum required to be able to switch back to the branch we
were recently on.

[jc: improvements from Dscho squashed in]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c
t/t2012-checkout-last.sh