From patchwork Wed Dec 4 21:24:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11273613 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 1821F139A for ; Wed, 4 Dec 2019 21:25:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA7AB206DF for ; Wed, 4 Dec 2019 21:25:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hirgMoZf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728042AbfLDVY4 (ORCPT ); Wed, 4 Dec 2019 16:24:56 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:34508 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727961AbfLDVYz (ORCPT ); Wed, 4 Dec 2019 16:24:55 -0500 Received: by mail-pj1-f68.google.com with SMTP id t21so338269pjq.1 for ; Wed, 04 Dec 2019 13:24:55 -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=EnvOE1VxzbSc13QEcl13K17m6JEvpfDSX4RaH1406rE=; b=hirgMoZfdR/8qF56VEUJMQvJbaTNXry0m8+0iOfvWTj10yCA6KT9Dl7D8OCh2a+I1X QY1/OZtBBMYnMhfQ6pSa/V4LaBZt/D4mv9ZEYaweJSPctPPa5iPm2vzgheVPGzeK9scu tQB6aLxRBRRFeIC4rUhfgXoHgewFKXrJRnfWhLqR+6zMAQ7RD4bHwOr2gXNo0yik9/cR oWS4Bb6Y6yHzzlTNJcBLovCmY5z9vlyQWgixFmCQcDkyh+958Jyx0DEdz4ip9JsaCIFb HENK5VQdfvalfG75xH4LsZhBf+6N39bmwpLg65kCVHQtbV8B7Rn/L5+9lk53akk2r/DK PlMw== 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=EnvOE1VxzbSc13QEcl13K17m6JEvpfDSX4RaH1406rE=; b=F34Jw5AmQSsD086S0nBiVbmsRHWYMrUgFrUKLEsNRrELJ53SE4bKxtM23tgn544E4W C9soVq/4Vi3MDlBs35qPV/3IKg+RVgok0Hn1cJZizkvRPDgPMqnflmzWm0RH22mvoj2r SgDQ2BCJFwNfcxkudB64NbU6CpdVULrU1G2a3FbFnDtPGJnwY6KkmPKmw/DbhP2NRTC+ f6j9JUrBRP2Crurc6KKWQiMyhc+41eYSzY3eUrs/cKsQgL9FnNlWPcRVb3NZyY5/jBIX JNaynhAtc0gixD8i02/p9xi0BjtFVj3ESyOCMKWf4OKWbv7x+aceZNe5LoIpwEdvF2dh b9Cw== X-Gm-Message-State: APjAAAUtRV2H9MXq3IcvdO5T2xghvCzGIeg/041vomsLXu2CZJLGC0cs DFt306AKpfuYD3VML0iJoy+7laAx X-Google-Smtp-Source: APXvYqyPQcqBrcd3a7UWd8cRe2W2GkgQHnE3VR9pywUptTYUx0QMqcI4BLfn2wEKnWaIeskRg+Sb7Q== X-Received: by 2002:a17:90a:f0d6:: with SMTP id fa22mr5454082pjb.136.1575494695126; Wed, 04 Dec 2019 13:24:55 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id p28sm7028755pgb.93.2019.12.04.13.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Dec 2019 13:24:54 -0800 (PST) Date: Wed, 4 Dec 2019 13:24:50 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine , Junio C Hamano , =?utf-8?b?UmVuw6k=?= Scharfe Subject: [PATCH v4 1/5] t3400: demonstrate failure with format.useAutoBase Message-ID: <386148a550bdbd06e3c35cd506f69c229a4df664.1575494618.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 Ever since bb52995f3e (format-patch: introduce format.useAutoBase configuration, 2016-04-26), `git rebase` has been broken when `format.useAutoBase = true`. It fails when rebasing a branch: 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. Demonstrate that failure here. Reported-by: Christian Biesinger Signed-off-by: Denton Liu --- t/t3400-rebase.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index ab18ac5f28..ca99e8c6c4 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -159,6 +159,12 @@ 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_config format.useAutoBase true && + git checkout topic && + git rebase master +' + test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg' ' git checkout -b default-base master && git checkout -b default topic && From patchwork Wed Dec 4 21:24:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11273615 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 4D0B6159A for ; Wed, 4 Dec 2019 21:25:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2172D206DF for ; Wed, 4 Dec 2019 21:25:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="epSI8Nil" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728071AbfLDVZB (ORCPT ); Wed, 4 Dec 2019 16:25:01 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:40893 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728053AbfLDVZB (ORCPT ); Wed, 4 Dec 2019 16:25:01 -0500 Received: by mail-pl1-f193.google.com with SMTP id g6so252042plp.7 for ; Wed, 04 Dec 2019 13:25:01 -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=9vkWyVPTtrMK6GEWgIf/a1BR/PZo9PO1eeJ9G6m+Xhk=; b=epSI8NilMrzO++S8EyCOujsdOuCcOnpU4uwqlG8bXOEGRaXd3GA2RWryVei7Ovgs7H iLxpuHe45ts/WNlpRb29ibQkNmmmx6cbIL9lpE3a0Hpi652hanRtctkK9d8DVJohRsfg oskVvOGLypBcOD5DlQhjDKq8EuWeCYLVbG+Da7gaT0AQ1KrLUFOBwo+wiJxAe02O3Yyz K6BfcpVCtxq9/Z+WVokV4M/oja5Us5iRCAFbbVqlojr17+ZW1vyzu1hUhKhgHZxfLoR3 SrXsC+24YwscpVbunM0JKhdTSzA0hBHIhrj3KqsikFBZb5nhhR5/NqaAc7z3MohmEmrK lV9A== 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=9vkWyVPTtrMK6GEWgIf/a1BR/PZo9PO1eeJ9G6m+Xhk=; b=KViVIuWaI/w2H2COpLaftvDxvHQELjhPjdw8WPQgV/VzfPjANX5zGeOXoqUfNnwJ4k /76ZiC/X2lAvZP9yV/tsdbTHkaS4ct8HHYbsWfuEyv05ayEko3yYzjLfuD7BRrbBfITK QEShVCeZLleKSJN9TdKwkKM45cCjA4J227cSIc5Uzlf3QtsKMv8OajfycOLdn1cbv886 j3PWVxKtgmrxBVupEAQ17yFFUkQl/xEP1rfHdxd/IqwLIKFMUnN2cmROtEUtOwIO9uU8 gSX+NyYBFqQe281LYbgKnyzRa/BORu24kzTfdHU0tS3WhDg2+k8SliXAYJYGmemNxU2Z O+fw== X-Gm-Message-State: APjAAAVTZBilxoY0sv8mBnk5QWjeAx4VqUI4YsX+s5qZ1FNlFzwNhaI4 yI6Y96OqCYlL4M1k+zbVTbv+H7kl X-Google-Smtp-Source: APXvYqyMh/SIWvPTpkN6FYJsqfcx2mom0awIYoZarKkMcxSkawmoxqyX6H5xDQjNGbeWuUPDBoSqtw== X-Received: by 2002:a17:902:409:: with SMTP id 9mr5443449ple.306.1575494700406; Wed, 04 Dec 2019 13:25:00 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id d22sm5252429pfo.187.2019.12.04.13.24.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Dec 2019 13:24:59 -0800 (PST) Date: Wed, 4 Dec 2019 13:24:55 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine , Junio C Hamano , =?utf-8?b?UmVuw6k=?= Scharfe Subject: [PATCH v4 2/5] format-patch: fix indentation Message-ID: <0464bd61c26109bc6d98ac56bb8bf1fe9d1a6864.1575494618.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 Signed-off-by: Denton Liu --- builtin/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/log.c b/builtin/log.c index a26f223ab4..9c44682f61 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1350,7 +1350,7 @@ static int header_callback(const struct option *opt, const char *arg, int unset) string_list_clear(&extra_to, 0); string_list_clear(&extra_cc, 0); } else { - add_header(arg); + add_header(arg); } return 0; } From patchwork Wed Dec 4 21:25:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11273617 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 15A13139A for ; Wed, 4 Dec 2019 21:25:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E7C20206DF for ; Wed, 4 Dec 2019 21:25:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QSbQbQxc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728104AbfLDVZH (ORCPT ); Wed, 4 Dec 2019 16:25:07 -0500 Received: from mail-pj1-f67.google.com ([209.85.216.67]:37798 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727961AbfLDVZG (ORCPT ); Wed, 4 Dec 2019 16:25:06 -0500 Received: by mail-pj1-f67.google.com with SMTP id ep17so333148pjb.4 for ; Wed, 04 Dec 2019 13:25:06 -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=mcvSIFKED6eEr6cLl9VnEAcgMfrYd6ySclhfRxTwBA4=; b=QSbQbQxc9jjDbj5BmjW3sq6glQ24leClu66A/10NHtA/sl3ZyGFCePZRC81jnPe00s +pmpZ7uN4jpG5BVV8N1vcj+4S0bbjVQAkWOpuPCP30eQrGz9Il2V12VZb2AhRH/HDrl7 voVD2xTDmqjHrU2jakzdt9alECX+do/oxGObwvB2Iz7F4IFrDriu/elqma0ZLjhR9Nz3 OV51uLX54myK+uPaWGEi9siII0jSqJCOHHE6dbHIVixnqJfe+2iBGvxN+lhUOGycjJxa wDfL0PJ8qxt3TyKZS24lQEaN2cGXHrmMRIM9i3VqhM6Knz/ZKEBJhd3y6S030iY1mzwy Zk2w== 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=mcvSIFKED6eEr6cLl9VnEAcgMfrYd6ySclhfRxTwBA4=; b=A0reIVciRs0yGp+0411tVHAbdb/xqCtFEq5zlYLaLPgAn7gWeo6tQ/qzSwrQuwtj1I Zu6EwBn+TEmeQYZh1Mh8HyAomncNGKl0+p4fvVgMlkY2tyeIqhQbiZGoiG67myV6csg6 XG8fvStVoExwfT60+AwfrZjqyS1rg3KH37MgIBOpBOeEA4QDqsWzy10b2WeQV9kQ+E4M B2eIWoCpLPhkSCjuGZPaztPuZL6a25CcTc9J96llbuLL/JxKXQrI7wveNWhHtrZv/iNq 68F5hlCXHuZzasNKRBs2G+FyX7m7UkyHYZTrMJN/K+v8bCM2ief40SFBYUwLJOPR8lgp Mk3w== X-Gm-Message-State: APjAAAU1h/mBLdHGrXp60tqrgZiM1sTW1raWrcf/Cz74qwSnIyyRUga3 EGwrLSIzN/j9PR8WjK0cmemSRv5t X-Google-Smtp-Source: APXvYqyDPqJZ5Vm3xiA90OP1QNTUEf/0yF8fJ9SZ/Jy5Zi/82IrZSyNNRyEecX/DmnW/Dzq+27MSOA== X-Received: by 2002:a17:902:760c:: with SMTP id k12mr5416974pll.33.1575494705786; Wed, 04 Dec 2019 13:25:05 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id m45sm7533038pje.32.2019.12.04.13.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Dec 2019 13:25:05 -0800 (PST) Date: Wed, 4 Dec 2019 13:25:00 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine , Junio C Hamano , =?utf-8?b?UmVuw6k=?= Scharfe Subject: [PATCH v4 3/5] t4014: use test_config() Message-ID: 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 Instead of manually unsetting the config after the test case is done, use test_config() to do it automatically. While we're at it, fix a typo in a test case name. Signed-off-by: Denton Liu --- t/t4014-format-patch.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 69267b16f0..c7cc643adf 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1939,10 +1939,9 @@ test_expect_success 'format-patch errors out when history involves criss-cross' test_must_fail git format-patch --base=auto -1 ' -test_expect_success 'format-patch format.useAutoBaseoption' ' - test_when_finished "git config --unset format.useAutoBase" && +test_expect_success 'format-patch format.useAutoBase option' ' git checkout local && - git config format.useAutoBase true && + test_config format.useAutoBase true && git format-patch --stdout -1 >patch && grep "^base-commit:" patch >actual && git rev-parse upstream >commit-id-base && @@ -1951,8 +1950,7 @@ test_expect_success 'format-patch format.useAutoBaseoption' ' ' test_expect_success 'format-patch --base overrides format.useAutoBase' ' - test_when_finished "git config --unset format.useAutoBase" && - git config format.useAutoBase true && + test_config format.useAutoBase true && git format-patch --stdout --base=HEAD~1 -1 >patch && grep "^base-commit:" patch >actual && git rev-parse HEAD~1 >commit-id-base && From patchwork Wed Dec 4 21:25:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11273619 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 877581593 for ; Wed, 4 Dec 2019 21:25:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5AB0C21835 for ; Wed, 4 Dec 2019 21:25:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R28dlRZP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728135AbfLDVZM (ORCPT ); Wed, 4 Dec 2019 16:25:12 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:36404 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727961AbfLDVZM (ORCPT ); Wed, 4 Dec 2019 16:25:12 -0500 Received: by mail-pl1-f195.google.com with SMTP id k20so262761pls.3 for ; Wed, 04 Dec 2019 13:25:11 -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:content-transfer-encoding:in-reply-to :user-agent; bh=oF1EKsTGUK9dL5hJenftgE4aUvn2WcznLGa6qvMFrX0=; b=R28dlRZPjABWY6Ib37ZZar4mxc+RfQCnHHX1vwyruWidPr4UXpFnPOXRxtvBfIuoXw FOPBaV5eyha/duw/3Qi9BOiwbr0DnGel4Ho22AFqw0eswf4NY6Ovpm4N0Ye3DA/bAvg6 I29jyvX/Rh+ikOe5NIghChhRn8l00h2814/+CILhHEqhljC3dYzDZMj8INOvxxl2EZA1 5lFtEgHXQXUvV2dVh5V8UPAs2E48QmGFPL77IT2h7iWtGIhFf3oFXtsBoBw9sZugWSdX fStz3Hc54ZRZPVO63OP5FO+Nkw61+lWgQ+AUbltTDUjWvcVD5Ym49c0gO8zMj4NE9H5m xv/w== 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:content-transfer-encoding :in-reply-to:user-agent; bh=oF1EKsTGUK9dL5hJenftgE4aUvn2WcznLGa6qvMFrX0=; b=tcmuEIQBiSlNZiAhnGqq5A1cFoXTFT+e8CiYZwZRmPcLNsa4uNpAA6nvwj60ohmid2 e5cosB423kCKt81r2AYxYZT1k7MCVjsU586E/kNZ8iO8ogbWNDlkfjLAa0IQab8WizRs AfsInWSY6Beuq5+zfTna5WV2vVoy4AAe9sk3XgosnhTrSD5fhHAjGa2bT5A/1xl83o5r AnNHNJl1RqiKp2pH4fJhGO+EQrUurzPI0djPExklYEnIgbp3JumOLr1y4Q1ByagT9aPY 1jShsEexDwuDMsSKslFn/kKOH28iN5Zf35Mxob7SnDYiBOVsqBwNvghm7pdyA750Uhcp Ac/Q== X-Gm-Message-State: APjAAAV60ET3nYcOlXV7zlSsnOm3j1ht1pH+VL8SJacv/eYBPIbBUxYk VSw7457EYJizonD9zlIiL1jdynFt X-Google-Smtp-Source: APXvYqxbHsYPpUEr+LOOHh4R0G9qb5OJH6mdSDVzsNXsh5LHlKNXOz+rkujuW32PuTkQA7mLWHlrSA== X-Received: by 2002:a17:902:7045:: with SMTP id h5mr5542422plt.245.1575494711176; Wed, 04 Dec 2019 13:25:11 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id f69sm7898852pje.32.2019.12.04.13.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Dec 2019 13:25:10 -0800 (PST) Date: Wed, 4 Dec 2019 13:25:06 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine , Junio C Hamano , =?utf-8?b?UmVuw6k=?= Scharfe Subject: [PATCH v4 4/5] format-patch: teach --no-base Message-ID: 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 If `format.useAutoBase = true`, there was no way to override this from the command-line. Teach the `--no-base` option in format-patch to override `format.useAutoBase`. Helped-by: René Scharfe Signed-off-by: Denton Liu --- Documentation/git-format-patch.txt | 5 +++-- builtin/log.c | 7 +++++-- t/t4014-format-patch.sh | 6 ++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt index 00bdf9b125..0d4f8951bb 100644 --- a/Documentation/git-format-patch.txt +++ b/Documentation/git-format-patch.txt @@ -333,11 +333,12 @@ you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`. Output an all-zero hash in each patch's From header instead of the hash of the commit. ---base=:: +--[no-]base[=]:: Record the base tree information to identify the state the patch series applies to. See the BASE TREE INFORMATION section below for details. If is "auto", a base commit is - automatically chosen. + automatically chosen. The `--no-base` option overrides a + `format.useAutoBase` configuration. --root:: Treat the revision argument as a , even if it diff --git a/builtin/log.c b/builtin/log.c index 9c44682f61..bf904e887f 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1406,7 +1406,7 @@ static struct commit *get_base_commit(const char *base_commit, base = lookup_commit_reference_by_name(base_commit); if (!base) die(_("unknown commit %s"), base_commit); - } else if ((base_commit && !strcmp(base_commit, "auto")) || base_auto) { + } else if ((base_commit && !strcmp(base_commit, "auto"))) { struct branch *curr_branch = branch_get(NULL); const char *upstream = branch_get_upstream(curr_branch, NULL); if (upstream) { @@ -1710,6 +1710,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) s_r_opt.def = "HEAD"; s_r_opt.revarg_opt = REVARG_COMMITTISH; + if (base_auto) + base_commit = "auto"; + if (default_attach) { rev.mime_boundary = default_attach; rev.no_inline = 1; @@ -1973,7 +1976,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) } memset(&bases, 0, sizeof(bases)); - if (base_commit || base_auto) { + if (base_commit) { struct commit *base = get_base_commit(base_commit, list, nr); reset_revision_walk(); clear_object_flags(UNINTERESTING); diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index c7cc643adf..a5b6302a1c 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1958,6 +1958,12 @@ test_expect_success 'format-patch --base overrides format.useAutoBase' ' test_cmp expect actual ' +test_expect_success 'format-patch --no-base overrides format.useAutoBase' ' + test_config format.useAutoBase true && + git format-patch --stdout --no-base -1 >patch && + ! grep "^base-commit:" patch +' + test_expect_success 'format-patch --base with --attach' ' git format-patch --attach=mimemime --stdout --base=HEAD~ -1 >patch && sed -n -e "/^base-commit:/s/.*/1/p" -e "/^---*mimemime--$/s/.*/2/p" \ From patchwork Wed Dec 4 21:25:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11273623 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 E894B139A for ; Wed, 4 Dec 2019 21:25:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C685921826 for ; Wed, 4 Dec 2019 21:25:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bguk2Udr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728194AbfLDVZR (ORCPT ); Wed, 4 Dec 2019 16:25:17 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:37343 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727961AbfLDVZR (ORCPT ); Wed, 4 Dec 2019 16:25:17 -0500 Received: by mail-pl1-f196.google.com with SMTP id bb5so260212plb.4 for ; Wed, 04 Dec 2019 13:25:17 -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=kb4cQuMYaVmmiyEtZuL05lzGUbcsfaDlmC1YhhlEG5Y=; b=bguk2UdrfqXBJ3kEKAXaqBiAzmu2q4oLFhoJoWs407de+a1JOkrKLe4x2t6ThZKoo+ bjT/NYX7zgQtFoNSgTcM+ZV2a2gcLiAxCwoof2W+N0loYw2jcjXrckEg7hEUPMAn5wwn v2BU+qVQCOdBijjoES1EgMS+Kpau88sykq+mMfi3b/InXEzgJzL/+e0ELJMXrvj9MFlC uhVkLDMKir8G1NTgPhnw+kfA6AhjLCc5mijC60O6QYs+px5pboRDbM8QtA29w7l/eZfI IvwLWJz08RtB2nw7p9TylURd7J/+ERzUuzOpksxTvTzOAV1sZK8/DCZz4HS+vwrLgKBV DraA== 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=kb4cQuMYaVmmiyEtZuL05lzGUbcsfaDlmC1YhhlEG5Y=; b=qNw9REHWkLxmwVAsGEM/KZwcKxej43cD2HDxH6Zf0uFBTjJZGETtcn37522FA0g/uu 5G4EQdxoR+jBpB4+njzD1V2qgWEBhJrxc9zr9q6+F2A9igTj6X1Yx1OAVgB7B26Je8ca tYsu8oT6NsGD/7o8gRyWUNZRk+JHa0xSCQG6XPY2xVbHkW+wGKZuPfUGDIrajrTnRMea Qg0hw3GHS+OBnxMFjcpUCKAqiFVDq3DQmcxuzw//6UHlBYsUQj1FJ8HaKt1af7315NNp l8wCFIDAma64KLZsim4W9fztbRpDVyjbmy3fMEyIcjv+L5OrI153xTue8p4Pa3osHICD o2dA== X-Gm-Message-State: APjAAAX62rid3qgs/Uo/46+xt3zoyZjA92DQxzdvdgvBdpX4i2Z6RTVb Uu2StlJT83c4LRI6bLqvNckGCDxH X-Google-Smtp-Source: APXvYqzsA0CgV5dkEtgeT9m3UVTUzZ2xPbHSaZ0C/O8OD9mtAij5RgR11uFRs2LdKF9fD0q59IAsuw== X-Received: by 2002:a17:902:6502:: with SMTP id b2mr5459976plk.182.1575494716415; Wed, 04 Dec 2019 13:25:16 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id k5sm7569509pju.14.2019.12.04.13.25.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Dec 2019 13:25:15 -0800 (PST) Date: Wed, 4 Dec 2019 13:25:11 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine , Junio C Hamano , =?utf-8?b?UmVuw6k=?= Scharfe Subject: [PATCH v4 5/5] rebase: fix format.useAutoBase breakage Message-ID: <210905f16303e9ce7ae3845e252bc07e288f70c1.1575494618.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: 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