mirror of
https://github.com/git/git.git
synced 2024-11-24 10:26:17 +08:00
Merge branch 'mz/rebase-abort-reflog-fix'
* mz/rebase-abort-reflog-fix: rebase --abort: do not update branch ref
This commit is contained in:
commit
6b236bfcb0
@ -275,15 +275,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
|
||||
|
@ -72,6 +72,18 @@ testrebase() {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user