summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9e42d6a)
raw | patch | inline | side by side (parent: 9e42d6a)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Fri, 23 Nov 2007 00:20:35 +0000 (00:20 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 29 Nov 2007 00:20:13 +0000 (16:20 -0800) |
When checking out another ref, the reflogs already record from which
branch you switched. Do that also when switching to a detached HEAD.
While at it, record also when coming _from_ a detached HEAD.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
branch you switched. Do that also when switching to a detached HEAD.
While at it, record also when coming _from_ a detached HEAD.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-checkout.sh | patch | blob | history |
diff --git a/git-checkout.sh b/git-checkout.sh
index f80939da5a15a006f2969cb966f4cdcc9dffdef9..f6d58ac044e5afb09855d687d3c1bcc8e2273be3 100755 (executable)
--- a/git-checkout.sh
+++ b/git-checkout.sh
if test -n "$branch"
then
old_branch_name=`expr "z$oldbranch" : 'zrefs/heads/\(.*\)'`
- GIT_DIR="$GIT_DIR" git symbolic-ref -m "checkout: moving from $old_branch_name to $branch" HEAD "refs/heads/$branch"
+ GIT_DIR="$GIT_DIR" git symbolic-ref -m "checkout: moving from ${old_branch_name:-$old} to $branch" HEAD "refs/heads/$branch"
if test -n "$quiet"
then
true # nothing
fi
elif test -n "$detached"
then
- git update-ref --no-deref -m "checkout: moving to $arg" HEAD "$detached" ||
+ old_branch_name=`expr "z$oldbranch" : 'zrefs/heads/\(.*\)'`
+ git update-ref --no-deref -m "checkout: moving from ${old_branch_name:-$old} to $arg" HEAD "$detached" ||
die "Cannot detach HEAD"
if test -n "$detach_warn"
then