am: remember --rerere-autoupdate setting
Save the rerere-autoupdate setting so that it is remembered after stopping for the user to resolve conflicts. 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
fd4a3f486d97682a0f42dfc84fe7af742bd76230
1 file changed
+12
builtin/am.c
+12
@@ -431,6 +431,14 @@ static void am_load(struct am_state *state)
431
read_state_file(&sb, state, "utf8", 1);
432
state->utf8 = !strcmp(sb.buf, "t");
433
434
+ if (file_exists(am_path(state, "rerere-autoupdate"))) {
435
+ read_state_file(&sb, state, "rerere-autoupdate", 1);
436
+ state->allow_rerere_autoupdate = strcmp(sb.buf, "t") ?
437
+ RERERE_NOAUTOUPDATE : RERERE_AUTOUPDATE;
438
+ } else {
439
+ state->allow_rerere_autoupdate = 0;
440
+ }
441
+
442
read_state_file(&sb, state, "keep", 1);
443
if (!strcmp(sb.buf, "t"))
444
state->keep = KEEP_TRUE;
@@ -1003,6 +1011,10 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
1011
write_state_bool(state, "sign", state->signoff);
1012
write_state_bool(state, "utf8", state->utf8);
1013
1014
+ if (state->allow_rerere_autoupdate)
1015
+ write_state_bool(state, "rerere-autoupdate",
1016
+ state->allow_rerere_autoupdate == RERERE_AUTOUPDATE);
1017
+
1018
switch (state->keep) {
1019
case KEEP_FALSE:
1020
str = "f";