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

[PATCH v2 03/18] builtin rebase: support --rerere-autoupdate

From
Pratik Karki via GitGitGadget <gitgitgadget@gmail.com>
Date
Sep 4, 2018, 21:59 UTC
Message-ID
<a301ef6bbdcdc1696991123cee078246deb65727.1536098386.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.33.v2.git.gitgitgadget@gmail.com>
From: Pratik Karki <predatoramigo@gmail.com>

The `--rerere-autoupdate` option allows rerere to update the index with resolved conflicts. This commit follows closely the equivalent part of `git-legacy-rebase.sh`.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 builtin/rebase.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index a491481120..1729d2d9e2 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -94,6 +94,7 @@ struct rebase_options {
 	struct strbuf git_am_opt;
 	const char *action;
 	int signoff;
+	int allow_rerere_autoupdate;
 };
 
 static int is_interactive(struct rebase_options *opts)
@@ -174,6 +175,21 @@ static int read_basic_state(struct rebase_options *opts)
 		opts->flags |= REBASE_FORCE;
 	}
 
+	if (file_exists(state_dir_path("allow_rerere_autoupdate", opts))) {
+		strbuf_reset(&buf);
+		if (read_one(state_dir_path("allow_rerere_autoupdate", opts),
+			    &buf))
+			return -1;
+		if (!strcmp(buf.buf, "--rerere-autoupdate"))
+			opts->allow_rerere_autoupdate = 1;
+		else if (!strcmp(buf.buf, "--no-rerere-autoupdate"))
+			opts->allow_rerere_autoupdate = 0;
+		else
+			warning(_("ignoring invalid allow_rerere_autoupdate: "
+				  "'%s'"), buf.buf);
+	} else
+		opts->allow_rerere_autoupdate = -1;
+
 	strbuf_release(&buf);
 
 	return 0;
@@ -256,6 +272,10 @@ static int run_specific_rebase(struct rebase_options *opts)
 		add_var(&script_snippet, "switch_to", opts->switch_to);
 	add_var(&script_snippet, "action", opts->action ? opts->action : "");
 	add_var(&script_snippet, "signoff", opts->signoff ? "--signoff" : "");
+	add_var(&script_snippet, "allow_rerere_autoupdate",
+		opts->allow_rerere_autoupdate < 0 ? "" :
+		opts->allow_rerere_autoupdate ?
+		"--rerere-autoupdate" : "--no-rerere-autoupdate");
 
 	switch (opts->type) {
 	case REBASE_AM:
@@ -488,6 +508,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		.type = REBASE_UNSPECIFIED,
 		.flags = REBASE_NO_QUIET,
 		.git_am_opt = STRBUF_INIT,
+		.allow_rerere_autoupdate  = -1,
 	};
 	const char *branch_name;
 	int ret, flags, total_argc, in_progress = 0;
@@ -553,6 +574,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		OPT_SET_INT('p', "preserve-merges", &options.type,
 			    N_("try to recreate merges instead of ignoring "
 			       "them"), REBASE_PRESERVE_MERGES),
+		OPT_BOOL(0, "rerere-autoupdate",
+			 &options.allow_rerere_autoupdate,
+			 N_("allow rerere to update index  with resolved "
+			    "conflict")),
 		OPT_END(),
 	};
 
-- 
gitgitgadget
Previous: Pratik Karki via GitGitGadgetNext: Pratik Karki via GitGitGadget
Message 26 of 44 in “builtin rebase options”
  1. Pratik KarkiAug 8, 2018
  2. 01/18 builtin rebase: allow selecting the rebase "backend"Pratik Karki, Aug 8, 2018
  3. 02/18 builtin rebase: support --signoffPratik Karki, Aug 8, 2018
  4. 03/18 builtin rebase: support --rerere-autoupdatePratik Karki, Aug 8, 2018
  5. 04/18 builtin rebase: support --committer-date-is-author-datePratik Karki, Aug 8, 2018
  6. 05/18 builtin rebase: support `ignore-whitespace` optionPratik Karki, Aug 8, 2018
  7. 06/18 builtin rebase: support `ignore-date` optionPratik Karki, Aug 8, 2018
  8. 07/18 builtin rebase: support `keep-empty` optionPratik Karki, Aug 8, 2018
  9. Johannes SchindelinAug 24, 2018
  10. 08/18 builtin rebase: support `--autosquash`Pratik Karki, Aug 8, 2018
  11. 09/18 builtin rebase: support `--gpg-sign` optionPratik Karki, Aug 8, 2018
  12. 10/18 builtin rebase: support `-C` and `--whitespace=<type>`Pratik Karki, Aug 8, 2018
  13. 11/18 builtin rebase: support `--autostash` optionPratik Karki, Aug 8, 2018
  14. Duy NguyenAug 18, 2018
  15. Johannes SchindelinAug 24, 2018
  16. 12/18 builtin rebase: support `--exec`Pratik Karki, Aug 8, 2018
  17. 13/18 builtin rebase: support `--allow-empty-message` optionPratik Karki, Aug 8, 2018
  18. 14/18 builtin rebase: support --rebase-merges[=[no-]rebase-cousins]Pratik Karki, Aug 8, 2018
  19. 15/18 merge-base --fork-point: extract libified functionPratik Karki, Aug 8, 2018
  20. 16/18 builtin rebase: support `fork-point` optionPratik Karki, Aug 8, 2018
  21. 17/18 builtin rebase: add support for custom merge strategiesPratik Karki, Aug 8, 2018
  22. 18/18 builtin rebase: support --rootPratik Karki, Aug 8, 2018
  23. 00/18 builtin rebase optionsJohannes Schindelin via GitGitGadget, Sep 4, 2018
  24. 01/18 builtin rebase: allow selecting the rebase "backend"Pratik Karki via GitGitGadget, Sep 4, 2018
  25. 02/18 builtin rebase: support --signoffPratik Karki via GitGitGadget, Sep 4, 2018
  26. 03/18 builtin rebase: support --rerere-autoupdatePratik Karki via GitGitGadget, Sep 4, 2018
  27. 04/18 builtin rebase: support --committer-date-is-author-datePratik Karki via GitGitGadget, Sep 4, 2018
  28. 05/18 builtin rebase: support `ignore-whitespace` optionPratik Karki via GitGitGadget, Sep 4, 2018
  29. 06/18 builtin rebase: support `ignore-date` optionPratik Karki via GitGitGadget, Sep 4, 2018
  30. 07/18 builtin rebase: support `keep-empty` optionPratik Karki via GitGitGadget, Sep 4, 2018
  31. 08/18 builtin rebase: support `--autosquash`Pratik Karki via GitGitGadget, Sep 4, 2018
  32. 09/18 builtin rebase: support `--gpg-sign` optionPratik Karki via GitGitGadget, Sep 4, 2018
  33. 11/18 builtin rebase: support `--autostash` optionPratik Karki via GitGitGadget, Sep 4, 2018
  34. 10/18 builtin rebase: support `-C` and `--whitespace=<type>`Pratik Karki via GitGitGadget, Sep 4, 2018
  35. 12/18 builtin rebase: support `--exec`Pratik Karki via GitGitGadget, Sep 4, 2018
  36. 13/18 builtin rebase: support `--allow-empty-message` optionPratik Karki via GitGitGadget, Sep 4, 2018
  37. 14/18 builtin rebase: support --rebase-merges[=[no-]rebase-cousins]Pratik Karki via GitGitGadget, Sep 4, 2018
  38. 15/18 merge-base --fork-point: extract libified functionPratik Karki via GitGitGadget, Sep 4, 2018
  39. 16/18 builtin rebase: support `fork-point` optionPratik Karki via GitGitGadget, Sep 4, 2018
  40. 17/18 builtin rebase: add support for custom merge strategiesPratik Karki via GitGitGadget, Sep 4, 2018
  41. 18/18 builtin rebase: support --rootPratik Karki via GitGitGadget, Sep 4, 2018
  42. Junio C HamanoSep 6, 2018
  43. Junio C HamanoSep 6, 2018
  44. Johannes SchindelinOct 12, 2018

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.