@@ -206,14 +206,13 @@ static int read_basic_state(struct rebase_options *opts)
206
206
& buf ))
207
207
return -1 ;
208
208
if (!strcmp (buf .buf , "--rerere-autoupdate" ))
209
- opts -> allow_rerere_autoupdate = 1 ;
209
+ opts -> allow_rerere_autoupdate = RERERE_AUTOUPDATE ;
210
210
else if (!strcmp (buf .buf , "--no-rerere-autoupdate" ))
211
- opts -> allow_rerere_autoupdate = 0 ;
211
+ opts -> allow_rerere_autoupdate = RERERE_NOAUTOUPDATE ;
212
212
else
213
213
warning (_ ("ignoring invalid allow_rerere_autoupdate: "
214
214
"'%s'" ), buf .buf );
215
- } else
216
- opts -> allow_rerere_autoupdate = -1 ;
215
+ }
217
216
218
217
if (file_exists (state_dir_path ("gpg_sign_opt" , opts ))) {
219
218
strbuf_reset (& buf );
@@ -263,10 +262,11 @@ static int rebase_write_basic_state(struct rebase_options *opts)
263
262
if (opts -> strategy_opts )
264
263
write_file (state_dir_path ("strategy_opts" , opts ), "%s" ,
265
264
opts -> strategy_opts );
266
- if (opts -> allow_rerere_autoupdate >= 0 )
265
+ if (opts -> allow_rerere_autoupdate > 0 )
267
266
write_file (state_dir_path ("allow_rerere_autoupdate" , opts ),
268
267
"-%s-rerere-autoupdate" ,
269
- opts -> allow_rerere_autoupdate ? "" : "-no" );
268
+ opts -> allow_rerere_autoupdate == RERERE_AUTOUPDATE ?
269
+ "" : "-no" );
270
270
if (opts -> gpg_sign_opt )
271
271
write_file (state_dir_path ("gpg_sign_opt" , opts ), "%s" ,
272
272
opts -> gpg_sign_opt );
@@ -625,9 +625,9 @@ static int run_am(struct rebase_options *opts)
625
625
argv_array_push (& am .args , "--rebasing" );
626
626
argv_array_pushf (& am .args , "--resolvemsg=%s" , resolvemsg );
627
627
argv_array_push (& am .args , "--patch-format=mboxrd" );
628
- if (opts -> allow_rerere_autoupdate > 0 )
628
+ if (opts -> allow_rerere_autoupdate == RERERE_AUTOUPDATE )
629
629
argv_array_push (& am .args , "--rerere-autoupdate" );
630
- else if (opts -> allow_rerere_autoupdate == 0 )
630
+ else if (opts -> allow_rerere_autoupdate == RERERE_NOAUTOUPDATE )
631
631
argv_array_push (& am .args , "--no-rerere-autoupdate" );
632
632
if (opts -> gpg_sign_opt )
633
633
argv_array_push (& am .args , opts -> gpg_sign_opt );
@@ -713,9 +713,9 @@ static int run_specific_rebase(struct rebase_options *opts)
713
713
argv_array_pushf (& child .args , "--cmd=%s" , opts -> cmd );
714
714
if (opts -> allow_empty_message )
715
715
argv_array_push (& child .args , "--allow-empty-message" );
716
- if (opts -> allow_rerere_autoupdate > 0 )
716
+ if (opts -> allow_rerere_autoupdate == RERERE_AUTOUPDATE )
717
717
argv_array_push (& child .args , "--rerere-autoupdate" );
718
- else if (opts -> allow_rerere_autoupdate == 0 )
718
+ else if (opts -> allow_rerere_autoupdate == RERERE_NOAUTOUPDATE )
719
719
argv_array_push (& child .args , "--no-rerere-autoupdate" );
720
720
if (opts -> gpg_sign_opt )
721
721
argv_array_push (& child .args , opts -> gpg_sign_opt );
@@ -764,9 +764,9 @@ static int run_specific_rebase(struct rebase_options *opts)
764
764
add_var (& script_snippet , "action" , opts -> action ? opts -> action : "" );
765
765
add_var (& script_snippet , "signoff" , opts -> signoff ? "--signoff" : "" );
766
766
add_var (& script_snippet , "allow_rerere_autoupdate" ,
767
- opts -> allow_rerere_autoupdate < 0 ? "" :
768
767
opts -> allow_rerere_autoupdate ?
769
- "--rerere-autoupdate" : "--no-rerere-autoupdate" );
768
+ opts -> allow_rerere_autoupdate == RERERE_AUTOUPDATE ?
769
+ "--rerere-autoupdate" : "--no-rerere-autoupdate" : "" );
770
770
add_var (& script_snippet , "keep_empty" , opts -> keep_empty ? "yes" : "" );
771
771
add_var (& script_snippet , "autosquash" , opts -> autosquash ? "t" : "" );
772
772
add_var (& script_snippet , "gpg_sign_opt" , opts -> gpg_sign_opt );
@@ -1007,7 +1007,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1007
1007
.type = REBASE_UNSPECIFIED ,
1008
1008
.flags = REBASE_NO_QUIET ,
1009
1009
.git_am_opts = ARGV_ARRAY_INIT ,
1010
- .allow_rerere_autoupdate = -1 ,
1011
1010
.allow_empty_message = 1 ,
1012
1011
.git_format_patch_opt = STRBUF_INIT ,
1013
1012
};
@@ -1101,10 +1100,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1101
1100
OPT_SET_INT ('p' , "preserve-merges" , & options .type ,
1102
1101
N_ ("try to recreate merges instead of ignoring "
1103
1102
"them" ), REBASE_PRESERVE_MERGES ),
1104
- OPT_BOOL (0 , "rerere-autoupdate" ,
1105
- & options .allow_rerere_autoupdate ,
1106
- N_ ("allow rerere to update index with resolved "
1107
- "conflict" )),
1103
+ OPT_RERERE_AUTOUPDATE (& options .allow_rerere_autoupdate ),
1108
1104
OPT_BOOL ('k' , "keep-empty" , & options .keep_empty ,
1109
1105
N_ ("preserve empty commits during rebase" )),
1110
1106
OPT_BOOL (0 , "autosquash" , & options .autosquash ,
0 commit comments