rebase -i: honor --rerere-autoupdate
Interactive rebase was ignoring '--rerere-autoupdate'. Fix this by reading it appropriate file when restoring the sequencer state for an interactive rebase and passing '--rerere-autoupdate' to merge and cherry-pick when rebasing with '--preserve-merges'. Reported-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood committed
Aug 2, 2017 at 11:44 UTC
9b6d7a6245e3be34a50a94a1174d8aebf5b1a263
3 files changed
+17
-3
git-rebase--interactive.sh
+4
-3
@@ -281,7 +281,7 @@ pick_one () {
281
282
test -d "$rewritten" &&
283
pick_one_preserving_merges "$@" && return
284
- output eval git cherry-pick \
284
+ output eval git cherry-pick $allow_rerere_autoupdate \
285
${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")} \
286
"$strategy_args" $empty_args $ff "$@"
287
@@ -393,7 +393,8 @@ pick_one_preserving_merges () {
393
merge_args="--no-log --no-ff"
394
if ! do_with_author output eval \
395
'git merge ${gpg_sign_opt:+"$gpg_sign_opt"} \
396
- $merge_args $strategy_args -m "$msg_content" $new_parents'
396
+ $allow_rerere_autoupdate $merge_args \
397
+ $strategy_args -m "$msg_content" $new_parents'
398
then
399
printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
400
die_with_patch $sha1 "$(eval_gettext "Error redoing merge \$sha1")"
@@ -401,7 +402,7 @@ pick_one_preserving_merges () {
402
echo "$sha1 $(git rev-parse HEAD^0)" >> "$rewritten_list"
403
;;
404
*)
404
- output eval git cherry-pick \
405
+ output eval git cherry-pick $allow_rerere_autoupdate \
406
${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")} \
407
"$strategy_args" "$@" ||
408
die_with_patch $sha1 "$(eval_gettext "Could not pick \$sha1")"
sequencer.c
+10
@@ -127,6 +127,7 @@ static GIT_PATH_FUNC(rebase_path_onto, "rebase-merge/onto")
127
static GIT_PATH_FUNC(rebase_path_autostash, "rebase-merge/autostash")
128
static GIT_PATH_FUNC(rebase_path_strategy, "rebase-merge/strategy")
129
static GIT_PATH_FUNC(rebase_path_strategy_opts, "rebase-merge/strategy_opts")
130
+static GIT_PATH_FUNC(rebase_path_allow_rerere_autoupdate, "rebase-merge/allow_rerere_autoupdate")
131
132
static inline int is_rebase_i(const struct replay_opts *opts)
133
{
@@ -1479,6 +1480,15 @@ static int read_populate_opts(struct replay_opts *opts)
1480
free(opts->gpg_sign);
1481
opts->gpg_sign = xstrdup(buf.buf + 2);
1482
}
1483
+ strbuf_reset(&buf);
1484
+ }
1485
+
1486
+ if (read_oneliner(&buf, rebase_path_allow_rerere_autoupdate(), 1)) {
1487
+ if (!strcmp(buf.buf, "--rerere-autoupdate"))
1488
+ opts->allow_rerere_auto = RERERE_AUTOUPDATE;
1489
+ else if (!strcmp(buf.buf, "--no-rerere-autoupdate"))
1490
+ opts->allow_rerere_auto = RERERE_NOAUTOUPDATE;
1491
+ strbuf_reset(&buf);
1492
}
1493
1494
if (file_exists(rebase_path_verbose()))
t/t3418-rebase-continue.sh
+3
@@ -141,5 +141,8 @@ test_rerere_autoupdate () {
141
142
test_rerere_autoupdate
143
test_rerere_autoupdate -m
144
+GIT_SEQUENCE_EDITOR=: && export GIT_SEQUENCE_EDITOR
145
+test_rerere_autoupdate -i
146
+test_rerere_autoupdate --preserve-merges
147
148
test_done