summaryrefslogtreecommitdiff
path: root/t/t2012-checkout-last.sh
AgeCommit message (Collapse)AuthorFilesLines
2013-06-17checkout: respect GIT_REFLOG_ACTIONLibravatar Ramkumar Ramachandra1-4/+4
GIT_REFLOG_ACTION is an environment variable specifying the reflog message to write after an action is completed. Several other commands including merge, reset, and commit respect it. Fix the failing tests in t/checkout-last by making checkout respect it too. You can now expect $ git checkout - to work as expected after any operation that internally uses "checkout" as its implementation detail, e.g. "rebase". Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-17t/t2021-checkout-last: "checkout -" should work after a rebase finishesLibravatar Ramkumar Ramachandra1-0/+34
$ git checkout - does not work as expected after a rebase. This is because the reflog records "checkout" made by "rebase" as its implementation detail the same way as end-user initiated "checkout", and makes it count as the branch that was previously checked out. Add four failing tests documenting this bug: two for a normal rebase, and another two for an interactive rebase. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-18"checkout A...B" switches to the merge base between A and BLibravatar Junio C Hamano1-1/+26
When flipping commits around on topic branches, I often end up doing this sequence: * Run "log --oneline next..jc/frotz" to find out the first commit on 'jc/frotz' branch not yet merged to 'next'; * Run "checkout $that_commit^" to detach HEAD to the parent of it; * Rebuild the series on top of that commit; and * "show-branch jc/frotz HEAD" and "diff jc/frotz HEAD" to verify. Introduce a new syntax to "git checkout" to name the commit to switch to, to make the first two steps easier. When the branch to switch to is specified as A...B (you can omit either A or B but not both, and HEAD is used instead of the omitted side), the merge base between these two commits are computed, and if there is one unique one, we detach the HEAD at that commit. With this, I can say "checkout next...jc/frotz". Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-19interpret_nth_last_branch(): avoid traversing the reflog twiceLibravatar Junio C Hamano1-0/+44
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>
2009-01-17checkout: implement "-" abbreviation, add docs and testsLibravatar Thomas Rast1-0/+50
Have '-' mean the same as '@{-1}', i.e., the last branch we were on. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>