summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1c7d402)
raw | patch | inline | side by side (parent: 1c7d402)
author | Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> | |
Sun, 21 Nov 2010 11:11:21 +0000 (12:11 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 24 Nov 2010 00:23:10 +0000 (16:23 -0800) |
If a non-interactive rebase of a ref fails at commit X and is aborted by
the user, the ref will be updated twice. First to point at X (with the
reflog message "rebase finished: $head_name onto $onto"), and then back
to $orig_head. It should not be updated at all.
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
the user, the ref will be updated twice. First to point at X (with the
reflog message "rebase finished: $head_name onto $onto"), and then back
to $orig_head. It should not be updated at all.
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase.sh | patch | blob | history | |
t/t3407-rebase-abort.sh | patch | blob | history |
diff --git a/git-rebase.sh b/git-rebase.sh
index 10a238ae3cc942bc021db18195b7098e2866c266..7c38c00a1e624553044512cdb737595bd66a46d6 100755 (executable)
--- a/git-rebase.sh
+++ b/git-rebase.sh
die "No rebase in progress?"
git rerere clear
- if test -d "$dotest"
- then
- GIT_QUIET=$(cat "$dotest/quiet")
- move_to_original_branch
- else
- dotest="$GIT_DIR"/rebase-apply
- GIT_QUIET=$(cat "$dotest/quiet")
- move_to_original_branch
- fi
+
+ test -d "$dotest" || dotest="$GIT_DIR"/rebase-apply
+
+ head_name="$(cat "$dotest"/head-name)" &&
+ case "$head_name" in
+ refs/*)
+ git symbolic-ref HEAD $head_name ||
+ die "Could not move back to $head_name"
+ ;;
+ esac
git reset --hard $(cat "$dotest/orig-head")
rm -r "$dotest"
exit
index fbb3f2e0dfcf1a0673dbd2022a4ed843990fce52..e573dc845b3d72004b2a96f344528c68977c52e1 100755 (executable)
--- a/t/t3407-rebase-abort.sh
+++ b/t/t3407-rebase-abort.sh
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
test ! -d "$dotest"
'
+
+ test_expect_success "rebase$type --abort does not update reflog" '
+ cd "$work_dir" &&
+ # Clean up the state from the previous one
+ git reset --hard pre-rebase &&
+ git reflog show to-rebase > reflog_before &&
+ test_must_fail git rebase$type master &&
+ git rebase --abort &&
+ git reflog show to-rebase > reflog_after &&
+ test_cmp reflog_before reflog_after &&
+ rm reflog_before reflog_after
+ '
}
testrebase "" .git/rebase-apply