Am 01.01.22 um 20:09 schrieb John Cai: > > >> On Jan 1, 2022, at 3:16 AM, René Scharfe <l.s.r@xxxxxx> wrote: >> >> The problem is that the default value can vary between reflogs and we >> only know which ones are to be expired after option parsing, right? > > That’s a good point. Does it matter that the default value varies between reflogs? > > Would something like this suffice? > > - for (i = 1; i < argc; i++) { > - const char *arg = argv[i]; > - if (starts_with(arg, "--expire=")) { > - explicit_expiry |= EXPIRE_TOTAL; > - } else if (starts_with(arg, "--expire-unreachable=")) { > - explicit_expiry |= EXPIRE_UNREACH; > - } > - } > - > argc = parse_options(argc, argv, prefix, options, reflog_expire_usage, 0); > > + if (cb.cmd.expire_total != default_reflog_expire) > + explicit_expiry |= EXPIRE_TOTAL; > + if (cb.cmd.expire_unreachable != default_reflog_expire_unreachable) > + explicit_expiry |= EXPIRE_UNREACH; This would ignore --expire and -expire-unreachable options with the value of default_reflog_expire and default_reflog_expire_unreachable, respectively. E.g. "git reflog expire --expire=90.days.ago refs/stash" would not expire anything. René