[PATCH v3 00/12] builtin/rerere: convert to use subcommands
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Nov 6, 2026, 15:13 UTC
- Message-ID
- <20261106-pks-rerere-subcommands-v3-0-4ff164d8fb81@pks.im>
- In-Reply-To
- <20261027-pks-rerere-subcommands-v1-0-d836c36ce0c5@pks.im>
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 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
---
Patrick Steinhardt (12):
rerere: rename `repo_rerere()`
rerere: convert flags into an enum
builtin/rerere: drop `the_repository`
builtin/rerere: stop passing flags to subcommands that ignore them
builtin/rerere: turn "forget" into a proper subcommand
builtin/rerere: turn "clear" into a proper subcommand
builtin/rerere: turn "status" into a proper subcommand
builtin/rerere: turn "remaining" into a proper subcommand
builtin/rerere: turn "diff" into a proper subcommand
builtin/rerere: turn "gc" into a proper subcommand
builtin/rerere: use `OPT_SUBCOMMAND()`
builtin/rerere: introduce proper usage strings for subcommandsDocumentation/git-rerere.adoc | 8 +- apply.c | 2 +- builtin/am.c | 4 +- builtin/commit.c | 2 +- builtin/merge.c | 2 +- builtin/rerere.c | 319 ++++++++++++++++++++++++++++++++---------- builtin/stash.c | 2 +- rerere.c | 12 +- rerere.h | 40 ++++-- sequencer.c | 4 +- t/t4200-rerere.sh | 5 - 11 files changed, 294 insertions(+), 106 deletions(-)
Range-diff versus v2:
1: 8d6b21c1ea2 = 1: 022fe75450a rerere: rename `repo_rerere()`
2: 3dd2a9cc7e0 ! 2: 1cb50bf5937 rerere: convert flags into an enum
@@ rerere.h: struct rerere_id {
+ */
+ RERERE_AUTOUPDATE = (1 << 0),
+
-+ /* Reverse of RERERE_AUTOUPDATE. */
++ /*
++ * Reverse of RERERE_AUTOUPDATE. That is, update the file in the
++ * working tree but don't touch the index.
++ */
+ RERERE_NOAUTOUPDATE = (1 << 1),
+
+ /* Skip acquiring the MERGE_RR.lock for a read-only operation. */
3: a69e7f43d2b = 3: d18adf008c9 builtin/rerere: drop `the_repository`
4: 86654ba3606 = 4: bc2eea0ba84 builtin/rerere: stop passing flags to subcommands that ignore them
5: f532910d986 = 5: 2b45e209b08 builtin/rerere: turn "forget" into a proper subcommand
6: 6340e1db614 = 6: 8e1a5cf4239 builtin/rerere: turn "clear" into a proper subcommand
7: 1c623efc48e = 7: aede0d76e54 builtin/rerere: turn "status" into a proper subcommand
8: debe0999ecb = 8: 114e40d5a51 builtin/rerere: turn "remaining" into a proper subcommand
9: 00bcc60a186 = 9: 7c523f60339 builtin/rerere: turn "diff" into a proper subcommand
10: 9cc14c726eb = 10: 6962d3ae764 builtin/rerere: turn "gc" into a proper subcommand
11: 8c90e572751 = 11: d9021a91b8e builtin/rerere: use `OPT_SUBCOMMAND()`
12: 11baa9ee058 = 12: 3b59da3d583 builtin/rerere: introduce proper usage strings for subcommands--- base-commit: 710910c03a22ac663885049213b9fef5853ea8e0 change-id: 20261027-pks-rerere-subcommands-318d41553438