From patchwork Wed Nov 27 02:09:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11263323 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C1E81390 for ; Wed, 27 Nov 2019 02:09:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48EC22071A for ; Wed, 27 Nov 2019 02:09:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="COJH78dP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727007AbfK0CJ1 (ORCPT ); Tue, 26 Nov 2019 21:09:27 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:37297 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726968AbfK0CJ1 (ORCPT ); Tue, 26 Nov 2019 21:09:27 -0500 Received: by mail-pj1-f68.google.com with SMTP id bb19so5643726pjb.4 for ; Tue, 26 Nov 2019 18:09:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JIRONt4eVDia24S068TJ4YBtQTJiUFIG9TnFAFHkdD0=; b=COJH78dPhWDqwJ/oJ56/pmg7gjt30sPiVXP6dG5teNOGBQTKlb0Xd7W8oyDdoLdDY/ 6eA03WeJ19hclnA6Os4Asu8Ff1/9c0OFcRRIK0V43febdlAjgv/i7oXh3FZW79ELz2ah s5V1tkDA0TytyHSpbuseLSXP5WQtvxm4iL0UK9sWmlAt6a0+Q8SeDXPcJzhPma4mQKoZ pbxEtTdouKH/RP4qpqlsGxs9jJJCVriGhplNNpUn1GeoXZPzAOnwDZVriH14olkjV6Yy fxWdQMSlgIsQtbDqRFXqzxUrt9cDJrWrpVZNG2MFSaJ/927wsF89+RX1mxuAnOQNbBT2 SKsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JIRONt4eVDia24S068TJ4YBtQTJiUFIG9TnFAFHkdD0=; b=bRq90DozR65sZ4hVQdMrcTrKnH1DRt6FI9mPfjhjx4VUI9Cxp++3h4iwtvkdIGL11T VdT1nz59+k2lne7SMXQ9Rwb+80usPP75Eb5N1aSKVwKwgiQgQ0x5EWew5rwyV+MTWvEW 4hSw1nZFeDS/a0PtjVmmJMI0Cv9TAXH1hiPwCw9+1rNjL6SxDrnucXibVHrWyKLHOdL3 xRMWjK2CwCXj1a8lA7b0iZnuljl886rqdgmZ78QQrSt8345MRG6IiLR+bJcNIlB9/Zyh 6jctXtLI5wFbx2lsfY5XAQBb3XGHySmN87erv/2PUp1ZlETf6kSdBl+Sak4GVRBWoV4P 6SJA== X-Gm-Message-State: APjAAAWCEtERAw4L8bqBopko4zk/WnIPRMac9m8rji+4cyLoS4Ab8LFm gjOhyCi+bAJmYnYFQ2R0g9cV9yzs X-Google-Smtp-Source: APXvYqzmVSYtprAsiuw4CyT77EMsXPd29exeJuJxwtsJexCosVpbyccL3whJQBwvk5VuLp+c4kkltQ== X-Received: by 2002:a17:90a:ec07:: with SMTP id l7mr2840369pjy.68.1574820564615; Tue, 26 Nov 2019 18:09:24 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id ds4sm4422916pjb.6.2019.11.26.18.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 18:09:24 -0800 (PST) Date: Tue, 26 Nov 2019 18:09:22 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger Subject: [PATCH 5/5] rebase: fix `format.useAutoBase` breakage Message-ID: <15e6ccb2037d1e27b461d2344a13ebf1d5e10136.1574820308.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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= 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 Signed-off-by: Denton Liu --- 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