git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 01/12] rerere: rename `repo_rerere()`

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 29, 2026, 09:57 UTC
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 <ps@pks.im>
---
 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
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 24 of 89 in “builtin/rerere: convert to use subcommands”
  1. 00/12 builtin/rerere: convert to use subcommandsPatrick Steinhardt, Oct 27, 2026
  2. 01/12 rerere: rename `repo_rerere()`Patrick Steinhardt, Oct 27, 2026
  3. Junio C HamanoOct 27, 2026
  4. Patrick SteinhardtOct 28, 2026
  5. Junio C HamanoOct 28, 2026
  6. 02/12 rerere: convert flags into an enumPatrick Steinhardt, Oct 27, 2026
  7. Mark C. Chu-CarrollOct 27, 2026
  8. Junio C HamanoOct 27, 2026
  9. Patrick SteinhardtOct 28, 2026
  10. Mark C. Chu-CarrollOct 28, 2026
  11. Junio C HamanoOct 28, 2026
  12. 03/12 builtin/rerere: drop `the_repository`Patrick Steinhardt, Oct 27, 2026
  13. 04/12 builtin/rerere: stop passing flags to subcommands that ignore themPatrick Steinhardt, Oct 27, 2026
  14. 05/12 builtin/rerere: turn "forget" into a proper subcommandPatrick Steinhardt, Oct 27, 2026
  15. 06/12 builtin/rerere: turn "clear" into a proper subcommandPatrick Steinhardt, Oct 27, 2026
  16. 07/12 builtin/rerere: turn "status" into a proper subcommandPatrick Steinhardt, Oct 27, 2026
  17. 08/12 builtin/rerere: turn "remaining" into a proper subcommandPatrick Steinhardt, Oct 27, 2026
  18. 09/12 builtin/rerere: turn "diff" into a proper subcommandPatrick Steinhardt, Oct 27, 2026
  19. 10/12 builtin/rerere: turn "gc" into a proper subcommandPatrick Steinhardt, Oct 27, 2026
  20. 11/12 builtin/rerere: use `OPT_SUBCOMMAND()`Patrick Steinhardt, Oct 27, 2026
  21. 12/12 builtin/rerere: introduce proper usage strings for subcommandsPatrick Steinhardt, Oct 27, 2026
  22. Junio C HamanoOct 27, 2026
  23. 00/12 builtin/rerere: convert to use subcommandsPatrick Steinhardt, Oct 29, 2026
  24. 01/12 rerere: rename `repo_rerere()`Patrick Steinhardt, Oct 29, 2026
  25. 02/12 rerere: convert flags into an enumPatrick Steinhardt, Oct 29, 2026
  26. Karthik NayakNov 6, 2026
  27. Patrick SteinhardtNov 6, 2026
  28. Karthik NayakNov 6, 2026
  29. 03/12 builtin/rerere: drop `the_repository`Patrick Steinhardt, Oct 29, 2026
  30. 04/12 builtin/rerere: stop passing flags to subcommands that ignore themPatrick Steinhardt, Oct 29, 2026
  31. 05/12 builtin/rerere: turn "forget" into a proper subcommandPatrick Steinhardt, Oct 29, 2026
  32. 06/12 builtin/rerere: turn "clear" into a proper subcommandPatrick Steinhardt, Oct 29, 2026
  33. 07/12 builtin/rerere: turn "status" into a proper subcommandPatrick Steinhardt, Oct 29, 2026
  34. 08/12 builtin/rerere: turn "remaining" into a proper subcommandPatrick Steinhardt, Oct 29, 2026
  35. 09/12 builtin/rerere: turn "diff" into a proper subcommandPatrick Steinhardt, Oct 29, 2026
  36. 10/12 builtin/rerere: turn "gc" into a proper subcommandPatrick Steinhardt, Oct 29, 2026
  37. Karthik NayakNov 6, 2026
  38. 11/12 builtin/rerere: use `OPT_SUBCOMMAND()`Patrick Steinhardt, Oct 29, 2026
  39. Karthik NayakNov 6, 2026
  40. Patrick SteinhardtNov 6, 2026
  41. 12/12 builtin/rerere: introduce proper usage strings for subcommandsPatrick Steinhardt, Oct 29, 2026
  42. Karthik NayakNov 6, 2026
  43. 00/12 builtin/rerere: convert to use subcommandsPatrick Steinhardt, Nov 6, 2026
  44. 01/12 rerere: rename `repo_rerere()`Patrick Steinhardt, Nov 6, 2026
  45. 02/12 rerere: convert flags into an enumPatrick Steinhardt, Nov 6, 2026
  46. Junio C HamanoNov 6, 2026
  47. Patrick SteinhardtNov 9, 2026
  48. Junio C HamanoNov 9, 2026
  49. Junio C HamanoNov 9, 2026
  50. Patrick SteinhardtNov 11, 2026
  51. 03/12 builtin/rerere: drop `the_repository`Patrick Steinhardt, Nov 6, 2026
  52. 04/12 builtin/rerere: stop passing flags to subcommands that ignore themPatrick Steinhardt, Nov 6, 2026
  53. 05/12 builtin/rerere: turn "forget" into a proper subcommandPatrick Steinhardt, Nov 6, 2026
  54. 06/12 builtin/rerere: turn "clear" into a proper subcommandPatrick Steinhardt, Nov 6, 2026
  55. 07/12 builtin/rerere: turn "status" into a proper subcommandPatrick Steinhardt, Nov 6, 2026
  56. 08/12 builtin/rerere: turn "remaining" into a proper subcommandPatrick Steinhardt, Nov 6, 2026
  57. 09/12 builtin/rerere: turn "diff" into a proper subcommandPatrick Steinhardt, Nov 6, 2026
  58. 10/12 builtin/rerere: turn "gc" into a proper subcommandPatrick Steinhardt, Nov 6, 2026
  59. 11/12 builtin/rerere: use `OPT_SUBCOMMAND()`Patrick Steinhardt, Nov 6, 2026
  60. 12/12 builtin/rerere: introduce proper usage strings for subcommandsPatrick Steinhardt, Nov 6, 2026
  61. 00/12 builtin/rerere: convert to use subcommandsPatrick Steinhardt, Nov 11, 2026
  62. 01/12 rerere: rename `repo_rerere()`Patrick Steinhardt, Nov 11, 2026
  63. 02/12 rerere: convert flags into an enumPatrick Steinhardt, Nov 11, 2026
  64. 03/12 builtin/rerere: drop `the_repository`Patrick Steinhardt, Nov 11, 2026
  65. 04/12 builtin/rerere: stop passing flags to subcommands that ignore themPatrick Steinhardt, Nov 11, 2026
  66. 05/12 builtin/rerere: turn "forget" into a proper subcommandPatrick Steinhardt, Nov 11, 2026
  67. 06/12 builtin/rerere: turn "clear" into a proper subcommandPatrick Steinhardt, Nov 11, 2026
  68. 07/12 builtin/rerere: turn "status" into a proper subcommandPatrick Steinhardt, Nov 11, 2026
  69. 08/12 builtin/rerere: turn "remaining" into a proper subcommandPatrick Steinhardt, Nov 11, 2026
  70. 09/12 builtin/rerere: turn "diff" into a proper subcommandPatrick Steinhardt, Nov 11, 2026
  71. Junio C HamanoNov 17, 2026
  72. 10/12 builtin/rerere: turn "gc" into a proper subcommandPatrick Steinhardt, Nov 11, 2026
  73. Junio C HamanoNov 17, 2026
  74. 11/12 builtin/rerere: use `OPT_SUBCOMMAND()`Patrick Steinhardt, Nov 11, 2026
  75. Junio C HamanoNov 17, 2026
  76. 12/12 builtin/rerere: introduce proper usage strings for subcommandsPatrick Steinhardt, Nov 11, 2026
  77. Junio C HamanoNov 17, 2026
  78. Karthik NayakNov 12, 2026
  79. Patrick SteinhardtNov 13, 2026
  80. Junio C HamanoNov 13, 2026
  81. Tuomas AholaNov 13, 2026
  82. Phillip WoodNov 13, 2026
  83. Junio C HamanoNov 13, 2026
  84. Tuomas AholaNov 14, 2026
  85. Patrick SteinhardtNov 16, 2026
  86. Junio C HamanoNov 14, 2026
  87. Patrick SteinhardtNov 16, 2026
  88. Junio C HamanoNov 16, 2026
  89. Junio C HamanoNov 17, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.