Skip to content

Commit b3e4847

Browse files
Martin von Zweigbergkgitster
authored andcommitted
rebase -m: remember allow_rerere_autoupdate option
If '--[no-]allow_rerere_autoupdate' is passed when 'git rebase -m' is called and a merge conflict occurs, the flag will be forgotten for the rest of the rebase process. Make rebase remember it by saving the value. Signed-off-by: Martin von Zweigbergk <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 80ff479 commit b3e4847

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

git-rebase.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ read_basic_state () {
8484
test -f "$state_dir"/strategy && strategy="$(cat "$state_dir"/strategy)"
8585
test -f "$state_dir"/strategy_opts &&
8686
strategy_opts="$(cat "$state_dir"/strategy_opts)"
87+
test -f "$state_dir"/allow_rerere_autoupdate &&
88+
allow_rerere_autoupdate="$(cat "$state_dir"/allow_rerere_autoupdate)"
8789
}
8890

8991
write_basic_state () {
@@ -95,6 +97,8 @@ write_basic_state () {
9597
test -n "$strategy" && echo "$strategy" > "$state_dir"/strategy
9698
test -n "$strategy_opts" && echo "$strategy_opts" > \
9799
"$state_dir"/strategy_opts
100+
test -n "$allow_rerere_autoupdate" && echo "$allow_rerere_autoupdate" > \
101+
"$state_dir"/allow_rerere_autoupdate
98102
}
99103

100104
output () {

t/t3418-rebase-continue.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,25 @@ test_expect_success 'rebase --continue remembers merge strategy and options' '
7474
test -f funny.was.run
7575
'
7676

77+
test_expect_success 'rebase --continue remembers --rerere-autoupdate' '
78+
rm -fr .git/rebase-* &&
79+
git reset --hard commit-new-file-F3-on-topic-branch &&
80+
git checkout master
81+
test_commit "commit-new-file-F3" F3 3 &&
82+
git config rerere.enabled true &&
83+
test_must_fail git rebase -m master topic &&
84+
echo "Resolved" >F2 &&
85+
git add F2 &&
86+
test_must_fail git rebase --continue &&
87+
echo "Resolved" >F3 &&
88+
git add F3 &&
89+
git rebase --continue &&
90+
git reset --hard topic@{1} &&
91+
test_must_fail git rebase -m --rerere-autoupdate master &&
92+
test "$(cat F2)" = "Resolved" &&
93+
test_must_fail git rebase --continue &&
94+
test "$(cat F3)" = "Resolved" &&
95+
git rebase --continue
96+
'
97+
7798
test_done

0 commit comments

Comments
 (0)