]> git.ipfire.org Git - thirdparty/git.git/commitdiff
rebase: fix format.useAutoBase breakage
authorDenton Liu <liu.denton@gmail.com>
Wed, 4 Dec 2019 21:25:11 +0000 (13:25 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Dec 2019 14:06:18 +0000 (06:06 -0800)
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 <cbiesinger@google.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rebase.c
t/t3400-rebase.sh

index e755087b0f1ebe11472ab4e4ef7165a4714e4e2f..51980ab63dbff672eb5a0964a3ccab2fff6d3d83 100644 (file)
@@ -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);
index ca99e8c6c4392fef1e1e61638cf447cb8a2fa23a..1323f30feee1737fb84af8f135768d565b39fa78 100755 (executable)
@@ -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