OSDN Git Service

rebase: write a reflog entry when finishing
authorJeff King <peff@peff.net>
Fri, 27 May 2011 20:16:14 +0000 (16:16 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 May 2011 22:52:03 +0000 (15:52 -0700)
When we finish a rebase, our detached HEAD is at the final
result. We update the original branch ref with this result,
and then point the HEAD symbolic ref at the updated branch.
We write a reflog for the branch update, but not for the
update of HEAD.

Because we're already at the final result on the detached
HEAD, moving to the branch actually doesn't change our
commit sha1 at all. So in that sense, a reflog entry would
be pointless.

However, humans do read reflogs, and an entry saying "rebase
finished: returning to refs/heads/master" can be helpful in
understanding what is going on.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase--interactive.sh
git-rebase.sh
t/t3404-rebase-interactive.sh

index 41ba96a..65690af 100644 (file)
@@ -510,7 +510,9 @@ do_next () {
        refs/*)
                message="$GIT_REFLOG_ACTION: $head_name onto $shortonto" &&
                git update-ref -m "$message" $head_name $newhead $orig_head &&
-               git symbolic-ref HEAD $head_name
+               git symbolic-ref \
+                 -m "$GIT_REFLOG_ACTION: returning to $head_name" \
+                 HEAD $head_name
                ;;
        esac && {
                test ! -f "$state_dir"/verbose ||
index 57cbe49..d7855ea 100755 (executable)
@@ -153,7 +153,9 @@ move_to_original_branch () {
                message="rebase finished: $head_name onto $onto"
                git update-ref -m "$message" \
                        $head_name $(git rev-parse HEAD) $orig_head &&
-               git symbolic-ref HEAD $head_name ||
+               git symbolic-ref \
+                       -m "rebase finished: returning to $head_name" \
+                       HEAD $head_name ||
                die "Could not move back to $head_name"
                ;;
        esac
index 7d8147b..47c8371 100755 (executable)
@@ -317,7 +317,7 @@ test_expect_success '--continue tries to commit' '
 '
 
 test_expect_success 'verbose flag is heeded, even after --continue' '
-       git reset --hard HEAD@{1} &&
+       git reset --hard master@{1} &&
        test_tick &&
        test_must_fail git rebase -v -i --onto new-branch1 HEAD^ &&
        echo resolved > file1 &&