From: Patrick Steinhardt Date: Thu, 29 Oct 2026 09:57:10 GMT Subject: [PATCH v2 01/12] rerere: rename `repo_rerere()` Message-ID: <20261029-pks-rerere-subcommands-v2-1-07d5ba18e882@pks.im> In-Reply-To: <20261029-pks-rerere-subcommands-v2-0-07d5ba18e882@pks.im> The `repo_rerere()` function is the only function in "rerere.h" that does not have a `rerere_` prefix. And while it does indeed receive a repository as first parameter, that's not a good-enough reason to give it a `repo_` prefix. Rename the function to just `rerere()`. Move around and extend documentation of this function to better explain what it does. Signed-off-by: Patrick Steinhardt --- apply.c | 2 +- builtin/am.c | 4 ++-- builtin/commit.c | 2 +- builtin/merge.c | 2 +- builtin/rerere.c | 2 +- builtin/stash.c | 2 +- rerere.c | 7 +------ rerere.h | 9 ++++++++- sequencer.c | 4 ++-- 9 files changed, 18 insertions(+), 16 deletions(-) diff --git a/apply.c b/apply.c index a0b7119c639..646fabeafa3 100644 --- a/apply.c +++ b/apply.c @@ -4866,7 +4866,7 @@ static int write_out_results(struct apply_state *state, struct patch *list) * tree with conflict markers, but that isn't written with --cached. */ if (!state->cached) - repo_rerere(state->repo, 0); + rerere(state->repo, 0); } return errs; diff --git a/builtin/am.c b/builtin/am.c index e9623b83077..4a5b37bee00 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1649,7 +1649,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa o.verbosity = 0; if (merge_ort_generic(&o, &our_tree, &their_tree, 1, bases, &result)) { - repo_rerere(the_repository, state->allow_rerere_autoupdate); + rerere(the_repository, state->allow_rerere_autoupdate); free(their_tree_name); return error(_("Failed to merge in the changes.")); } @@ -1979,7 +1979,7 @@ static void am_resolve(struct am_state *state, int allow_empty) goto next; } - repo_rerere(the_repository, 0); + rerere(the_repository, 0); do_commit(state); diff --git a/builtin/commit.c b/builtin/commit.c index 8ffd42681bb..3a4b94ad623 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1962,7 +1962,7 @@ int cmd_commit(int argc, git_test_write_commit_graph_or_die(the_repository); - repo_rerere(the_repository, 0); + rerere(the_repository, 0); run_auto_maintenance(the_repository, quiet); run_commit_hook(use_editor, repo_get_index_file(the_repository), NULL, "post-commit", NULL); diff --git a/builtin/merge.c b/builtin/merge.c index d7bf209114f..089e36e8575 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1061,7 +1061,7 @@ static int suggest_conflicts(void) fputs(msgbuf.buf, fp); strbuf_release(&msgbuf); fclose(fp); - repo_rerere(the_repository, allow_rerere_auto); + rerere(the_repository, allow_rerere_auto); printf(_("Automatic merge failed; " "fix conflicts and then commit the result.\n")); return 1; diff --git a/builtin/rerere.c b/builtin/rerere.c index 2c17f02f56d..a499e7b9151 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -83,7 +83,7 @@ int cmd_rerere(int argc, flags = RERERE_NOAUTOUPDATE; if (argc < 1) - return repo_rerere(the_repository, flags); + return rerere(the_repository, flags); if (!strcmp(argv[0], "forget")) { struct pathspec pathspec; diff --git a/builtin/stash.c b/builtin/stash.c index e1a3a76bd04..91870a255fd 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -688,7 +688,7 @@ static enum stash_apply_result do_apply_stash(const char *prefix, ret = error(_("could not write index")); if (ret) { - repo_rerere(the_repository, 0); + rerere(the_repository, 0); if (index) fprintf_ln(stderr, _("Index was not unstashed.")); diff --git a/rerere.c b/rerere.c index e0897612085..47a4a325bf5 100644 --- a/rerere.c +++ b/rerere.c @@ -951,12 +951,7 @@ int rerere_cache_setup(struct rerere_cache *cache, return fd; } -/* - * The main entry point that is called internally from codepaths that - * perform mergy operations, possibly leaving conflicted index entries - * and working tree files. - */ -int repo_rerere(struct repository *r, int flags) +int rerere(struct repository *r, int flags) { struct string_list merge_rr = STRING_LIST_INIT_DUP; struct rerere_cache cache; diff --git a/rerere.h b/rerere.h index d3cbd10e13f..dd9da03d6db 100644 --- a/rerere.h +++ b/rerere.h @@ -45,7 +45,14 @@ int rerere_cache_setup(struct rerere_cache *cache, int flags); void rerere_cache_release(struct rerere_cache *cache); -int repo_rerere(struct repository *, int); +/* + * The main entry point that is called internally from codepaths that + * perform mergy operations, possibly leaving conflicted index entries + * and working tree files. It records (and optionally updates) resolved + * conflicts and reuses recorded resolutions for unresolved conflicts. + */ +int rerere(struct repository *r, int flags); + /* * Given the conflict ID and the name of a "file" used for replaying * the recorded resolution (e.g. "preimage", "postimage"), return the diff --git a/sequencer.c b/sequencer.c index 508ec717920..ace1cfac1cb 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2556,7 +2556,7 @@ static enum pick_result do_pick_commit(struct repository *r, : _("could not apply %s... %s"), short_commit_name(r, commit), msg.subject); print_advice(r, res == 1, opts); - repo_rerere(r, opts->allow_rerere_auto); + rerere(r, opts->allow_rerere_auto); goto leave; } @@ -4488,7 +4488,7 @@ static int do_merge(struct repository *r, rollback_lock_file(&lock); if (ret) - repo_rerere(r, opts->allow_rerere_auto); + rerere(r, opts->allow_rerere_auto); else /* * In case of problems, we now want to return a positive -- 2.56.0.341.g393f52fd96.dirty