Thread View: linux.kernel.git
6 messages
6 total messages
Started by Karthik Nayak
Thu, 12 Nov 2026 13:41
Re: [PATCH v4 00/12] builtin/rerere: convert to use subcommands
Author: Karthik Nayak
Date: Thu, 12 Nov 2026 13:41
Date: Thu, 12 Nov 2026 13:41
129 lines
17862 bytes
17862 bytes
--0000000000001086f206601478b6
Content-Type: text/plain; charset="UTF-8"
Patrick Steinhardt <ps@pks.im> writes:
> Hi,
>
> while reviewing some patch series around git-rerere(1) recently I was a
> bit appalled by our custom subcommand parsing that we do here. This
> patch series here thus cleans up and modernizes that part a bit so that
> git-rerere(1) behaves like every other Git command that happens to have
> subcommands.
>
> This series is based on 37b3475fb53 (The 9th batch, 2026-10-25) with
> ps/rerere-remove-global-state at b948c10c8b3 (rerere: get rid of global
> rerere cache state, 2026-10-23) merged into it.
>
> Changes in v4:
> - Some more polishing for `RERERE_{NO,}AUTOUPDATE` documentation.
> - Die in case both of these flags are passed.
Definitely a welcome improvement!
> - Link to v3: https://patch.msgid.link/20261106-pks-rerere-subcommands-v3-0-4ff164d8fb81@pks.im
>
> Changes in v3:
> - Clarify what `RERERE_NOAUTOUPDATE` does.
> - Link to v2: https://patch.msgid.link/20261029-pks-rerere-subcommands-v2-0-07d5ba18e882@pks.im
>
> Changes in v2:
> - Document rerere flags.
> - Rename `rerere_record()` to just `rerere()`.
> - Link to v1: https://patch.msgid.link/20261027-pks-rerere-subcommands-v1-0-d836c36ce0c5@pks.im
>
> Thanks!
>
> Patrick
[snip]
> 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/Update
> ++ * can be used to explicitly override "rerere.autoUpdate".
> ++ *
> ++ * This flag is essentially the reverse of `RERERE_AUTOUPDATE`. It is
> ++ * invalid to pass both flags at the same time.
> + */
> + RERERE_NOAUTOUPDATE = (1 << 1),
> +
> 3: 99faad47068 = 3: 48692c2c88d builtin/rerere: drop `the_repository`
> 4: f164c482227 = 4: e76991dd39d builtin/rerere: stop passing flags to subcommands that ignore them
> 5: 0573d2323e8 = 5: 2474dca4713 builtin/rerere: turn "forget" into a proper subcommand
> 6: 2098dedf4fd = 6: cecdbb1c63b builtin/rerere: turn "clear" into a proper subcommand
> 7: e8eaa2b4092 = 7: 54fc766f9d2 builtin/rerere: turn "status" into a proper subcommand
> 8: a5781284b8b = 8: fa2c839b2cb builtin/rerere: turn "remaining" into a proper subcommand
> 9: 9a4278df0ea = 9: 416b8311ca9 builtin/rerere: turn "diff" into a proper subcommand
> 10: e63b9be0d74 = 10: adb2b68f833 builtin/rerere: turn "gc" into a proper subcommand
> 11: 47889896ecb = 11: a12e19cb2e8 builtin/rerere: use `OPT_SUBCOMMAND()`
> 12: 5e16a247b49 = 12: 4b1b6170ba3 builtin/rerere: introduce proper usage strings for subcommands
>
> ---
> base-commit: 710910c03a22ac663885049213b9fef5853ea8e0
> change-id: 20261027-pks-rerere-subcommands-318d41553438
Looks good. Thanks!
--0000000000001086f206601478b6
Content-Type: application/pgp-signature; name="signature.asc"
Content-Disposition: attachment; filename="signature.asc"
Content-Transfer-Encoding: base64
X-Attachment-Id: 19f44f958ad5829d_0.1
LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSEtCQUVCQ2dBMEZpRUVWODVNZjJOMWNR
L0xaY1lHUHRXZkpJNUdqSDhGQW1yMXdnY1dIR3RoY25Sb2FXc3UKTVRnNFFHZHRZV2xzTG1OdmJR
QUtDUkErMVo4a2prYU1mK1RlREFDQXdtQndRWjRpNHRJTzNNaVZnSzdOOVMwbwo0OW5uTmExamNB
em5tWlB2SFN6MXVxMExIbkEvYThHN1QrMENvZ1Zydjd2NVJhdFhtTEhVTEVuTGN1bXdLOUpsCjcv
Snc0LzU3VFhxQ3lBNzh3VVRvKzQzZDJIT3Z0REF1QUFlUlBqbnFUVVF2YjNhRXN5ZkZ2UkNjQlZJ
dE4vbXcKRlZENDg0cHYwSDdvbDVwK3RWUll1OHRzbG1mUU8rd1l5TkhxQnlvMFpaNlhiN1RONDYr
djM5dkowaVRtRzY2RQpaUjZtSXJjMXJwUjFpdE1hNzBaSEVRSzVCMFNzWHlvUyt4QkYxWXBJa2l5
SmJ1YXovMm83cmVZdXFxSTRMV0RyCkJvOElFV1U2VlVMeDR2M2ZreDlZMGlwR2VyRlFWNTRic0Js
R3NHWm1ubWd3ODMxZ0R3NWtjanBNa2lHK2xjRG8KOVBkVXpJVVYwSVFjVngzYjd1VFNEaHIya25K
Qmk2ZGczeUlVTlYzZTlyTGhBYjYwamJuRC9lRE1GVy9kdG1RLwpTYmQ0cVdTbG04bk04Wnc0TXY5
VStTc3dwd3pnRFh0Q1hWVnliMHNad3JSTWVGWmdQdUFtTE1Sei9nbG5QNjhmCnJnRWNHYlUxcGxu
SUpJdjNObW5qN1dBOHhLSENjZ2psVGhyRml0MD0KPVRQbEQKLS0tLS1FTkQgUEdQIFNJR05BVFVS
RS0tLS0t
--0000000000001086f206601478b6--
Re: [PATCH v4 00/12] builtin/rerere: convert to use subcommands
Author: Junio C Hamano
Date: Fri, 13 Nov 2026 18:09
Date: Fri, 13 Nov 2026 18:09
36 lines
13986 bytes
13986 bytes
Patrick Steinhardt <ps@pks.im> writes:
>> > @@ 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/Update
>
> Oops, 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!
$ git checkout ps/rerere-subcommands
$ edit rerere.h
$ git log --oneline --first-parent master..
$ git commit -a --fixup HEAD~10
$ git rebase --autosquash HEAD~11
By the way, I wonder if we can simplify the last three steps in any
way?
* We can use 'HEAD^{/^rerere: convert flags}' instead of counting.
* The last "rebase" does not have to be on HEAD~11; as long as it
covers HEAD~10 it is OK, but we cannot use 'master' as I am *not*
interested in taking any new development from there, and I do not
want to worry about what the command would do on the merges the
topic has as synthetic base.
Perhaps with newer experimental commands it becomes easier to
manage?
Re: [PATCH v4 00/12] builtin/rerere: convert to use subcommands
Author: Tuomas Ahola
Date: Fri, 13 Nov 2026 19:38
Date: Fri, 13 Nov 2026 19:38
44 lines
11227 bytes
11227 bytes
Junio C Hamano <gitster@pobox.com> wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> >> > @@ 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/Update
> >
> > Oops, 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!
>
> $ git checkout ps/rerere-subcommands
> $ edit rerere.h
> $ git log --oneline --first-parent master..
> $ git commit -a --fixup HEAD~10
> $ git rebase --autosquash HEAD~11
>
> By the way, I wonder if we can simplify the last three steps in any
> way?
>
> * We can use 'HEAD^{/^rerere: convert flags}' instead of counting.
>
> * The last "rebase" does not have to be on HEAD~11; as long as it
> covers HEAD~10 it is OK, but we cannot use 'master' as I am *not*
> interested in taking any new development from there, and I do not
> want to worry about what the command would do on the merges the
> topic has as synthetic base.
>
Just for hack's sake :-)
$ git rebase --autosquash $(git rev-list --min-parents=2 --max-count=1 HEAD)
> Perhaps with newer experimental commands it becomes easier to
> manage?
>
Re: [PATCH v4 00/12] builtin/rerere: convert to use subcommands
Author: Phillip Wood
Date: Fri, 13 Nov 2026 19:44
Date: Fri, 13 Nov 2026 19:44
26 lines
12140 bytes
12140 bytes
On 13/11/2026 18:09, Junio C Hamano wrote:
>
> $ git checkout ps/rerere-subcommands
> $ edit rerere.h
> $ git log --oneline --first-parent master..
> $ git commit -a --fixup HEAD~10
> $ git rebase --autosquash HEAD~11
>
> By the way, I wonder if we can simplify the last three steps in any
> way?
>
> * We can use 'HEAD^{/^rerere: convert flags}' instead of counting.
>
> * The last "rebase" does not have to be on HEAD~11; as long as it
> covers HEAD~10 it is OK, but we cannot use 'master' as I am *not*
> interested in taking any new development from there, and I do not
> want to worry about what the command would do on the merges the
> topic has as synthetic base.
So long as you've set an upstream branch, you can use "--keep-base" and
omit the upstream commit.
Thanks
Phillip
Re: [PATCH v4 00/12] builtin/rerere: convert to use subcommands
Author: Junio C Hamano
Date: Fri, 13 Nov 2026 21:44
Date: Fri, 13 Nov 2026 21:44
37 lines
14086 bytes
14086 bytes
Phillip Wood <phillip.wood123@gmail.com> writes:
> On 13/11/2026 18:09, Junio C Hamano wrote:
>>
>> $ git checkout ps/rerere-subcommands
>> $ edit rerere.h
>> $ git log --oneline --first-parent master..
>> $ git commit -a --fixup HEAD~10
>> $ git rebase --autosquash HEAD~11
>>
>> By the way, I wonder if we can simplify the last three steps in any
>> way?
>>
>> * We can use 'HEAD^{/^rerere: convert flags}' instead of counting.
>>
>> * The last "rebase" does not have to be on HEAD~11; as long as it
>> covers HEAD~10 it is OK, but we cannot use 'master' as I am *not*
>> interested in taking any new development from there, and I do not
>> want to worry about what the command would do on the merges the
>> topic has as synthetic base.
>
> So long as you've set an upstream branch, you can use "--keep-base" and
> omit the upstream commit.
I do not think I want to set upstream for ~600 topic branches (among
~100 are still in flight) I keep around. I was hoping that after
making fixup changes in my editor and adding them to the index
$ edit rerere.h
$ git add -u
A single command that names the target of the added change
$ git fixup HEAD~10
would automatically do the two "commit && rebase" commands.
Re: [PATCH v4 00/12] builtin/rerere: convert to use subcommands
Author: Tuomas Ahola
Date: Sat, 14 Nov 2026 07:22
Date: Sat, 14 Nov 2026 07:22
42 lines
11306 bytes
11306 bytes
Junio C Hamano <gitster@pobox.com> wrote:
> Phillip Wood <phillip.wood123@gmail.com> writes:
>
> > On 13/11/2026 18:09, Junio C Hamano wrote:
> >>
> >> $ git checkout ps/rerere-subcommands
> >> $ edit rerere.h
> >> $ git log --oneline --first-parent master..
> >> $ git commit -a --fixup HEAD~10
> >> $ git rebase --autosquash HEAD~11
> >>
> >> By the way, I wonder if we can simplify the last three steps in any
> >> way?
> >>
> >> * We can use 'HEAD^{/^rerere: convert flags}' instead of counting.
> >>
> >> * The last "rebase" does not have to be on HEAD~11; as long as it
> >> covers HEAD~10 it is OK, but we cannot use 'master' as I am *not*
> >> interested in taking any new development from there, and I do not
> >> want to worry about what the command would do on the merges the
> >> topic has as synthetic base.
> >
> > So long as you've set an upstream branch, you can use "--keep-base" and
> > omit the upstream commit.
>
> I do not think I want to set upstream for ~600 topic branches (among
> ~100 are still in flight) I keep around. I was hoping that after
> making fixup changes in my editor and adding them to the index
>
> $ edit rerere.h
> $ git add -u
>
> A single command that names the target of the added change
>
> $ git fixup HEAD~10
>
> would automatically do the two "commit && rebase" commands.
>
Which is exactly what 'git history fixup HEAD~10' strives to do, isn't it?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads