Re: [PATCH v4 00/12] builtin/rerere: convert to use subcommands
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Nov 13, 2026, 07:20 UTC
- Message-ID
- <ava6Q1u65ASVeth5@pks.im>
- In-Reply-To
- <CAOLa=ZTAYtq0K4YfcSBocf-fxadTiaJp+AV5-_6_pbNMBwYQXA@mail.gmail.com>
On Thu, Nov 12, 2026 at 05:41:29AM -0800, Karthik Nayak wrote:
Show 44 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> > Range-diff versus v3:
> >
> > 1: e9237465706 = 1: f669dc6eddf rerere: rename `repo_rerere()`
> > 2: 94d91a0620d ! 2: 4fd3f6aa650 rerere: convert flags into an enum
> > @@ Commit message
> > around as enums so that it becomes trivial to see what kind of flags are
> > expected. Adapt the rerere flags accordingly and document them.
> >
> > + While at it, detect the case where both `RERERE_AUTOUPDATE` and
> > + `RERERE_NOAUTOUPDATE` are passed. This combination does not make a lot
> > + of sense, and it's not obvious which of those flags takes precedence
> > + (it's `RERERE_AUTOUPDATE`). All current callers know to only pass one of
> > + those flags, but let's be safe rather than sorry and `BUG()` in case
> > + both are passed.
> > +
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> >
> > ## rerere.c ##
> > @@ rerere.c: static int is_rerere_enabled(struct repository *r)
> > {
> > int lock_timeout_ms = 1000;
> > int fd;
> > +@@ rerere.c: int rerere_cache_setup(struct rerere_cache *cache,
> > + repo_config_get_bool(r, "rerere.autoupdate", &cache->autoupdate);
> > + repo_config_get_int(r, "rerere.locktimeout", &lock_timeout_ms);
> > +
> > ++ if ((flags & RERERE_AUTOUPDATE) && (flags & RERERE_NOAUTOUPDATE))
> > ++ BUG("RERERE_AUTOUPDATE cannot be used with RERERE_NOAUTOUPDATE");
> > + if (flags & (RERERE_AUTOUPDATE|RERERE_NOAUTOUPDATE))
> > + cache->autoupdate = !!(flags & RERERE_AUTOUPDATE);
> > + if ((flags & RERERE_READONLY) && (flags & RERERE_NOWAIT))
> > @@ rerere.c: int rerere_cache_setup(struct rerere_cache *cache,
> > return fd;
> > }
> > @@ rerere.h: struct rerere_id {
> > + RERERE_AUTOUPDATE = (1 << 0),
> > +
> > + /*
> > -+ * Reverse of RERERE_AUTOUPDATE. That is, update the file in the
> > -+ * working tree but don't touch the index.
> > ++ * update the file in the working tree but don't touch the index. This
>
> Nit: s/update/UpdateOops, good catch. I'll refrain from sending out another version just to fix this one fix though. Junio, I'd appreciate it if you could fix this up in your tree. Thanks!
Patrick