author | Junio C Hamano <gitster@pobox.com> | |
Mon, 19 Jan 2009 08:04:25 +0000 (00:04 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 19 Jan 2009 23:35:21 +0000 (15:35 -0800) | ||
commit | c2883e62f5b9980e5402431f2261c961354d0f15 | |
tree | be6de693adb7e9b21e95e9409dc06a7d341d9133 | tree | snapshot |
parent | 696acf45f9638b014c7132508de26d1a571c8a33 | commit | diff |
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>
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 | diff | blob | history | |
t/t2012-checkout-last.sh | diff | blob | history |