@@ -21,14 +21,14 @@ static unsigned long default_reflog_expire;
21
21
static unsigned long default_reflog_expire_unreachable ;
22
22
23
23
enum expire_reflog_flags {
24
- EXPIRE_REFLOGS_DRY_RUN = 1 << 0
24
+ EXPIRE_REFLOGS_DRY_RUN = 1 << 0 ,
25
+ EXPIRE_REFLOGS_UPDATE_REF = 1 << 1
25
26
};
26
27
27
28
struct cmd_reflog_expire_cb {
28
29
struct rev_info revs ;
29
30
int stalefix ;
30
31
int rewrite ;
31
- int updateref ;
32
32
int verbose ;
33
33
unsigned long expire_total ;
34
34
unsigned long expire_unreachable ;
@@ -474,7 +474,7 @@ static int expire_reflog(const char *refname, const unsigned char *sha1,
474
474
if (close_lock_file (& reflog_lock )) {
475
475
status |= error ("couldn't write %s: %s" , log_file ,
476
476
strerror (errno ));
477
- } else if (cmd -> updateref &&
477
+ } else if (( flags & EXPIRE_REFLOGS_UPDATE_REF ) &&
478
478
(write_in_full (lock -> lock_fd ,
479
479
sha1_to_hex (cb .last_kept_sha1 ), 40 ) != 40 ||
480
480
write_str_in_full (lock -> lock_fd , "\n" ) != 1 ||
@@ -485,7 +485,7 @@ static int expire_reflog(const char *refname, const unsigned char *sha1,
485
485
} else if (commit_lock_file (& reflog_lock )) {
486
486
status |= error ("unable to commit reflog '%s' (%s)" ,
487
487
log_file , strerror (errno ));
488
- } else if (cmd -> updateref && commit_ref (lock )) {
488
+ } else if (( flags & EXPIRE_REFLOGS_UPDATE_REF ) && commit_ref (lock )) {
489
489
status |= error ("couldn't set %s" , lock -> ref_name );
490
490
}
491
491
}
@@ -677,7 +677,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
677
677
else if (!strcmp (arg , "--rewrite" ))
678
678
cb .rewrite = 1 ;
679
679
else if (!strcmp (arg , "--updateref" ))
680
- cb . updateref = 1 ;
680
+ flags |= EXPIRE_REFLOGS_UPDATE_REF ;
681
681
else if (!strcmp (arg , "--all" ))
682
682
do_all = 1 ;
683
683
else if (!strcmp (arg , "--verbose" ))
@@ -759,7 +759,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
759
759
else if (!strcmp (arg , "--rewrite" ))
760
760
cb .rewrite = 1 ;
761
761
else if (!strcmp (arg , "--updateref" ))
762
- cb . updateref = 1 ;
762
+ flags |= EXPIRE_REFLOGS_UPDATE_REF ;
763
763
else if (!strcmp (arg , "--verbose" ))
764
764
cb .verbose = 1 ;
765
765
else if (!strcmp (arg , "--" )) {
0 commit comments