summaryrefslogtreecommitdiff
path: root/git-rebase.sh
diff options
context:
space:
mode:
authorMartin von Zweigbergk <martin.von.zweigbergk@gmail.com>2010-11-21 12:11:21 +0100
committerJunio C Hamano <gitster@pobox.com>2010-11-23 16:23:10 -0800
commit729ec9e23a13a0610a19a24901d0ab5e2bc44a12 (patch)
tree583b1ecb0f83d5e0c10dbc2bfec4cabcf472cb7c /git-rebase.sh
parent1c7d402b3e1e9d7e50abfbfb18c88bc79be468ea (diff)
downloadgit-729ec9e23a13a0610a19a24901d0ab5e2bc44a12.tar.gz
rebase --abort: do not update branch ref
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>
Diffstat (limited to 'git-rebase.sh')
-rwxr-xr-xgit-rebase.sh19
1 files changed, 10 insertions, 9 deletions
diff --git a/git-rebase.sh b/git-rebase.sh
index 10a238ae3c..7c38c00a1e 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -274,15 +274,16 @@ do
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