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

[PATCH 5/5] rebase: fix `format.useAutoBase` breakage

From
Denton Liu <liu.denton@gmail.com>
Date
Nov 27, 2019, 02:09 UTC
Message-ID
<15e6ccb2037d1e27b461d2344a13ebf1d5e10136.1574820308.git.liu.denton@gmail.com>
In-Reply-To
<cover.1574820308.git.liu.denton@gmail.com>

With `format.useAutoBase = true`, running rebase resulted in an error when an upstream was't set:

	fatal: failed to get upstream, if you want to record base commit automatically,
	please use git branch --set-upstream-to to track a remote branch.
	Or you could specify base commit by --base=<base-commit-id> manually
	error:
	git encountered an error while preparing the patches to replay
	these revisions:
	    ede2467cdedc63784887b587a61c36b7850ebfac..d8f581194799ae29bf5fa72a98cbae98a1198b12
	As a result, git cannot rebase them.

Fix this by always passing `--no-base` to format-patch from rebase so that the effect of `format.useAutoBase` is negated.

Reported-by: Christian Biesinger <cbiesinger@google.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
 builtin/rebase.c  | 3 ++-
 t/t3400-rebase.sh | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index e755087b0f..51980ab63d 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1012,7 +1012,8 @@ static int run_am(struct rebase_options *opts)
 	argv_array_pushl(&format_patch.args, "format-patch", "-k", "--stdout",
 			 "--full-index", "--cherry-pick", "--right-only",
 			 "--src-prefix=a/", "--dst-prefix=b/", "--no-renames",
-			 "--no-cover-letter", "--pretty=mboxrd", "--topo-order", NULL);
+			 "--no-cover-letter", "--pretty=mboxrd", "--topo-order",
+			 "--no-base", NULL);
 	if (opts->git_format_patch_opt.len)
 		argv_array_split(&format_patch.args,
 				 opts->git_format_patch_opt.buf);
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index ca99e8c6c4..1323f30fee 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -159,7 +159,7 @@ test_expect_success 'fail when upstream arg is missing and not configured' '
 	test_must_fail git rebase
 '
 
-test_expect_failure 'rebase works with format.useAutoBase' '
+test_expect_success 'rebase works with format.useAutoBase' '
 	test_config format.useAutoBase true &&
 	git checkout topic &&
 	git rebase master
-- 
2.24.0.504.g3cd56eb17d
Previous: Denton LiuNext: Eric Sunshine
Message 9 of 33 in “Bug with "git rebase" when format.useAutoBase is set”
  1. Christian BiesingerNov 26, 2019
  2. 0/5 rebase: fix breakage with `format.useAutoBase`Denton Liu, Nov 27, 2019
  3. 1/5 t3400: demonstrate failure with format.useAutoBaseDenton Liu, Nov 27, 2019
  4. Eric SunshineNov 27, 2019
  5. Junio C HamanoNov 30, 2019
  6. 2/5 format-patch: fix indentationDenton Liu, Nov 27, 2019
  7. 3/5 t4014: use `test_config`Denton Liu, Nov 27, 2019
  8. 4/5 format-patch: teach --no-baseDenton Liu, Nov 27, 2019
  9. 5/5 rebase: fix `format.useAutoBase` breakageDenton Liu, Nov 27, 2019
  10. Eric SunshineNov 27, 2019
  11. Christian BiesingerNov 27, 2019
  12. 0/5 rebase: fix breakage with `format.useAutoBase`Denton Liu, Nov 27, 2019
  13. 1/5 t3400: demonstrate failure with format.useAutoBaseDenton Liu, Nov 27, 2019
  14. 2/5 format-patch: fix indentationDenton Liu, Nov 27, 2019
  15. 3/5 t4014: use test_config()Denton Liu, Nov 27, 2019
  16. 4/5 format-patch: teach --no-baseDenton Liu, Nov 27, 2019
  17. Denton LiuNov 27, 2019
  18. 5/5 rebase: fix format.useAutoBase breakageDenton Liu, Nov 27, 2019
  19. Christian BiesingerDec 4, 2019
  20. 0/5 rebase: fix breakage with `format.useAutoBase`Denton Liu, Dec 4, 2019
  21. 1/5 t3400: demonstrate failure with format.useAutoBaseDenton Liu, Dec 4, 2019
  22. 2/5 format-patch: fix indentationDenton Liu, Dec 4, 2019
  23. 4/5 format-patch: teach --no-baseDenton Liu, Dec 4, 2019
  24. René ScharfeDec 4, 2019
  25. Junio C HamanoDec 4, 2019
  26. 3/5 t4014: use test_config()Denton Liu, Dec 4, 2019
  27. 5/5 rebase: fix format.useAutoBase breakageDenton Liu, Dec 4, 2019
  28. 0/5 rebase: fix breakage with `format.useAutoBase`Denton Liu, Dec 4, 2019
  29. 1/5 t3400: demonstrate failure with format.useAutoBaseDenton Liu, Dec 4, 2019
  30. 2/5 format-patch: fix indentationDenton Liu, Dec 4, 2019
  31. 3/5 t4014: use test_config()Denton Liu, Dec 4, 2019
  32. 4/5 format-patch: teach --no-baseDenton Liu, Dec 4, 2019
  33. 5/5 rebase: fix format.useAutoBase breakageDenton Liu, Dec 4, 2019

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.