rebase: write a reflog entry when finishing
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>
Jeff King committed
May 27, 2011 at 16:16 UTC
53f2ffa80c1c5ea5feb9fbe7432bf7106cf3047e
3 files changed
+7
-3
git-rebase--interactive.sh
+3
-1
@@ -510,7 +510,9 @@ do_next () {
510
refs/*)
511
message="$GIT_REFLOG_ACTION: $head_name onto $shortonto" &&
512
git update-ref -m "$message" $head_name $newhead $orig_head &&
513
- git symbolic-ref HEAD $head_name
513
+ git symbolic-ref \
514
+ -m "$GIT_REFLOG_ACTION: returning to $head_name" \
515
+ HEAD $head_name
516
;;
517
esac && {
518
test ! -f "$state_dir"/verbose ||
git-rebase.sh
+3
-1
@@ -153,7 +153,9 @@ move_to_original_branch () {
153
message="rebase finished: $head_name onto $onto"
154
git update-ref -m "$message" \
155
$head_name $(git rev-parse HEAD) $orig_head &&
156
- git symbolic-ref HEAD $head_name ||
156
+ git symbolic-ref \
157
+ -m "rebase finished: returning to $head_name" \
158
+ HEAD $head_name ||
159
die "Could not move back to $head_name"
160
;;
161
esac
t/t3404-rebase-interactive.sh
+1
-1
@@ -317,7 +317,7 @@ test_expect_success '--continue tries to commit' '
317
'
318
319
test_expect_success 'verbose flag is heeded, even after --continue' '
320
- git reset --hard HEAD@{1} &&
320
+ git reset --hard master@{1} &&
321
test_tick &&
322
test_must_fail git rebase -v -i --onto new-branch1 HEAD^ &&
323
echo resolved > file1 &&