Skip to content

Commit cae0bc0

Browse files
Denton-Lgitster
authored andcommitted
rebase: fix format.useAutoBase breakage
With `format.useAutoBase = true`, running rebase resulted in an error: 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 <[email protected]> Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 945dc55 commit cae0bc0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

builtin/rebase.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,8 @@ static int run_am(struct rebase_options *opts)
10121012
argv_array_pushl(&format_patch.args, "format-patch", "-k", "--stdout",
10131013
"--full-index", "--cherry-pick", "--right-only",
10141014
"--src-prefix=a/", "--dst-prefix=b/", "--no-renames",
1015-
"--no-cover-letter", "--pretty=mboxrd", "--topo-order", NULL);
1015+
"--no-cover-letter", "--pretty=mboxrd", "--topo-order",
1016+
"--no-base", NULL);
10161017
if (opts->git_format_patch_opt.len)
10171018
argv_array_split(&format_patch.args,
10181019
opts->git_format_patch_opt.buf);

t/t3400-rebase.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ test_expect_success 'fail when upstream arg is missing and not configured' '
159159
test_must_fail git rebase
160160
'
161161

162-
test_expect_failure 'rebase works with format.useAutoBase' '
162+
test_expect_success 'rebase works with format.useAutoBase' '
163163
test_config format.useAutoBase true &&
164164
git checkout topic &&
165165
git rebase master

0 commit comments

Comments
 (0)