From patchwork Wed Nov 27 02:09: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: 11263313 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 C975217F0 for ; Wed, 27 Nov 2019 02:09:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A84BF207DD for ; Wed, 27 Nov 2019 02:09:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hsGg5ZZI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726934AbfK0CJQ (ORCPT ); Tue, 26 Nov 2019 21:09:16 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:46655 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725940AbfK0CJP (ORCPT ); Tue, 26 Nov 2019 21:09:15 -0500 Received: by mail-pl1-f193.google.com with SMTP id k20so4562514pll.13 for ; Tue, 26 Nov 2019 18:09:15 -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=nEBQ4SrCH9y+VGLndRCzMRAkZ1/rR3U/yXLtaXzvIVY=; b=hsGg5ZZIvdCDRVzT39qOms2BvcdggkFgZ7hlM3Sqc1bhSnBYxl3iLm8/XqD6hksbu0 P3IjLuwuA+1V/AQaciz136VQ9OUgy3PoENgrwEohvY5qPTqpeCZHVrX4DRkCGgC8FMw4 fV6Yd6nJqb58R9HCcTztGtrlGZvbtila0rb1OeQo2+7s+9KF6AQ4UUkhCFeVNrsG2koy qvpgLkRhtZFiOdlBEStGkLTc85ytceGAvLhGm/IU9RLkfkhVBjy/sxqbun0sUacH/4jl CEidZmnFOo6QUVLt8VKMB7M1km72qHtyuZSCmfGvJ4MhSDvpdfk+5A9Q/PPuhI2J6+oP EzNQ== 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=nEBQ4SrCH9y+VGLndRCzMRAkZ1/rR3U/yXLtaXzvIVY=; b=reo+scbrsU2lF80cIJ/QE/U/QsB7QU3VtsZzFOFs55WPeqVrZrCK3kvESFcMzbL/4g Z7eMBdNtu2ObpWFUnnEojUhG+H2XaD1SQXBf89IdhY89KxQMThCm8UTTk29rQPt25635 min71MvqpLGWBGlS16Kzt4uVZh4p2CGcj7DhL3ALvX0hHzNIH7uG96YCsU3qCifHdOZr b0n6rV8Og6u/O7WKhEUUBKw08VQYpx20+REQruP50HZ39/rbPAu6ejGxQVfG8YzKbyBJ 0T8lfq2aW2ceK0zz+d4XKnzKmxmmC5NcZzCs5jOD2dt1WJfIuyTGmboklmPpf/oMv/ir AYRQ== X-Gm-Message-State: APjAAAWvS765JbUktP3jDdW4J3cofHjsoezS0PNO128yhWTJ2pm2be5g yaG+XmxG85GjBO4kD12JNaITqKyA X-Google-Smtp-Source: APXvYqwz8CJMeLJmduijPg/UIgtolxiYs+iJhfn+bXFxpbVHcyecyFnqu1EjDtuFX2PgjW6710Wu+Q== X-Received: by 2002:a17:902:d696:: with SMTP id v22mr1547128ply.66.1574820554624; Tue, 26 Nov 2019 18:09:14 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id t27sm14252046pfq.169.2019.11.26.18.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 18:09:13 -0800 (PST) Date: Tue, 26 Nov 2019 18:09:11 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger Subject: [PATCH 1/5] t3400: demonstrate failure with format.useAutoBase 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 Ever since bb52995f3e (format-patch: introduce format.useAutoBase configuration, 2016-04-26), `git rebase` has been broken when `format.useAutoBase = true`. 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 Nov 27 02:09:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11263317 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 8A6821390 for ; Wed, 27 Nov 2019 02:09:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5CEF02071A for ; Wed, 27 Nov 2019 02:09:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="i0e1soR+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726957AbfK0CJS (ORCPT ); Tue, 26 Nov 2019 21:09:18 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:44067 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725940AbfK0CJS (ORCPT ); Tue, 26 Nov 2019 21:09:18 -0500 Received: by mail-pj1-f65.google.com with SMTP id w8so9178513pjh.11 for ; Tue, 26 Nov 2019 18:09: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=NPUPRFNgA55bR53Me1Y5XvKcvI1X3geLvm8Cel38M74=; b=i0e1soR+pUUeEue0AKAqtkIQEt/dGfECt5vdh/4pgAV6zz2hqxyUF7bGYfW3zIA/hD Gt4yD2S0zTb2m7lFskBzoGtDUP8LS5gVKMaLGbKmdrwKsu5rHvPhhQz55PsRGeaDhYH0 3haW435q+oP65YBdUjiyas9QhdAr1IJWbHrBrGKUlakqyjhC+rfb4F/wteRxx8x1+goM SKbUD9MtEP4slscR9I4BcYluzW/thZEmnD1SqxsQKcslTtVcPBUvTsMGtJtADRK+yJE9 TXSCExedN+CUkSXPnb3WDTaCX6eVw5Xr7gnGbEVL8Cjp9QlfgNlfBtD4b4jtIcKStG0U EF0w== 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=NPUPRFNgA55bR53Me1Y5XvKcvI1X3geLvm8Cel38M74=; b=glSHnblKH+ZAgsSIN3CrQu1RcsIFURh7A0ENVhCxkcS0Gvi0/MFc0VQ53Ckad36fmD l34wUif3RzEwiof/qp+9mln3t3VDmJFEWrqgsafvFKkuMWOexlrwg06r7RasiC2LPXh+ mPNUzvRciQGYnmtwMMRa2cUKU9059W+Fo7s67IsLOFtxylMS3rhuL80xYP4XJOt+qldx sjIYB4aVEeDUlFGRGL0/yWG8YEvMFFLgzMzuLJhegOqP32QlXBTj4C6qYq0kfUoUutTy jHLfvycxQFhSEoK5iquf9XcG79cUOQZb8rL69p7h8UM2CHBfmETFEOth9Abn8488Mv4h eEaQ== X-Gm-Message-State: APjAAAXbB1awIdaBVPkcMHmqwS2O2kksfYOsBRxEqPKPFJkKGBSLCX+O Rj/vpVUpKL9cxT7jopkcjnK5tMzr X-Google-Smtp-Source: APXvYqxZlgWq33b4hqI9cW0PGkCkRsBHwV8XsxgLugLpUjYL02vSRhSgFOiRVzEPH3rS8xRgZ2j/rA== X-Received: by 2002:a17:90a:3be4:: with SMTP id e91mr3025816pjc.56.1574820557314; Tue, 26 Nov 2019 18:09:17 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id a9sm1868908pfo.106.2019.11.26.18.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 18:09:16 -0800 (PST) Date: Tue, 26 Nov 2019 18:09:14 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger Subject: [PATCH 2/5] format-patch: fix indentation Message-ID: <46fd4113aad5bd6c9925304eca35c808274982ba.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 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 Nov 27 02:09:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11263319 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 0B2121390 for ; Wed, 27 Nov 2019 02:09:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE16D20722 for ; Wed, 27 Nov 2019 02:09:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oJsuHaLa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726980AbfK0CJV (ORCPT ); Tue, 26 Nov 2019 21:09:21 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45866 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726968AbfK0CJU (ORCPT ); Tue, 26 Nov 2019 21:09:20 -0500 Received: by mail-pl1-f195.google.com with SMTP id w7so9003699plz.12 for ; Tue, 26 Nov 2019 18:09:20 -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=vHGDzFR1Hxyn1LZWp+Ad9rvJ8yhBkTUT8f7WuFicfaU=; b=oJsuHaLaHvBj2fj4g8Fn1qwpWo1HgAcT5/oscIzBrLUN7CjMt2doLXGsHdw2kvSgC/ dF0UruGrXZzs0LDY6RjY1IBrwr1RNqGiD0biiFn6/mJSXUVeKwAvXvRQ9hbH3KcAdBe+ pmCRxMuXNCIUCcMtl2BmiZFbdgb8hR+2nIpcDaDRWOxi3T/6Mm0EQHBUIJF3MdspjJCW lQgyE+e2aYEroKp1QtSsec10kYwOrUj/9lrP0sKz24yL3HG6XV401KnYRzOnAu864HzU OfzHs7gyi7N9jHpVZNuOPVdSGJAsTi3+SyhYbAjqdMWHzeGYlcPMzUXhfdGT3GFciT0K G2bA== 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=vHGDzFR1Hxyn1LZWp+Ad9rvJ8yhBkTUT8f7WuFicfaU=; b=jTAUoRoQYrOlaln6tqLSSsxZFLySkDurVhxwfyOv0FGMhHgftEqcZLOepvyeV/Q/9G rv3Ceq3ckEshjH67MW1976xJLa7SK5khmfDWmGduBNKJDh/Wx/IqQvv2Ld1sG4tR5OIC pJwzNYe7tCGYOw23VhfvsrqXFyX1SfI04dyvsJS5S0qNHM3a3ehnwNZHLpQuzIhPw5c5 8zbqcGSe/z7bhq+TC0vNmTuHkw3CSJdu8P8Bo8rUisqrioROHQ/hb1tdROvX8iMTChkN 1v5b6DO+kzifvgP6Py4V+IaA0viTba9LjxpWZCtseTsDWcl1/P4fEqY0nHVUG3FTtgv9 9IXg== X-Gm-Message-State: APjAAAWO6RDYEjNXTrj4qijA3zOs3YS1ayiEs0bafddgI6D8BeV8S+lV ZeDI7F/7vPgdMxSwmeWCxDDgLIBw X-Google-Smtp-Source: APXvYqwe959Sh29fDsHMWe8C9+T5dcZawa2jglOGv7SZwP3cp5ASE/wbfvhDcjPyxR50HsKpjmEDoQ== X-Received: by 2002:a17:90a:ba89:: with SMTP id t9mr2803050pjr.138.1574820559563; Tue, 26 Nov 2019 18:09:19 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id u3sm13751576pgp.51.2019.11.26.18.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 18:09:19 -0800 (PST) Date: Tue, 26 Nov 2019 18:09:17 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger Subject: [PATCH 3/5] t4014: use `test_config` Message-ID: <22b1fb14f9ac841e93b6177cec216530a6756d7c.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 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 Nov 27 02:09:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11263321 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 9E5D414DB for ; Wed, 27 Nov 2019 02:09:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7CA70207DD for ; Wed, 27 Nov 2019 02:09:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YmD5Z/YJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726990AbfK0CJX (ORCPT ); Tue, 26 Nov 2019 21:09:23 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:42133 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726983AbfK0CJX (ORCPT ); Tue, 26 Nov 2019 21:09:23 -0500 Received: by mail-pj1-f65.google.com with SMTP id y21so9186287pjn.9 for ; Tue, 26 Nov 2019 18:09:23 -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=WduSD2IPzjEU0/WgYXmAZ9p6BxEYXVae+cF+2ORr6kg=; b=YmD5Z/YJW2FGtcAU0ciktGznv8OtPmK5rdcsuGg6l+Soex9/Jvcd47QEY/flJLpeev sk9ksCDB/z/8MuhIamswIU3mnL9b6sHtk6ZRO42kOwu3cc40f0ytn/Eb8m12tWKiuRGQ ywxAoeNvpChBEzOueB/R56sRPiPeJADsgveeC1ZiHCU1rOZ5cSsKF12WATc1SqtTIUf2 2RQqgZel4mzzL4Use1Cg6mMjsRdcglwHSibIrBSeCGj2UAJ6FYi9wznr4/EZq+vWFwJc 5ChbV8bLXwQRYfCLu7cmgkleHZ3c1XgmwDy0pXgJZ5jWm7RE7vwjEdvp+Uc060LrOXdJ Tzug== 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=WduSD2IPzjEU0/WgYXmAZ9p6BxEYXVae+cF+2ORr6kg=; b=VfKB2xjgOVSsqgsDnuSbMTi4+IvV1Sp5FIOYUuZct7r4Bbo9SFG9QSa8pn0yO9LX89 bGme6OOMqFzv4qYqXOBtn70l9cBiVjZYRhbBNbjNcAJTJFROz47snbGiz6BDJ2NRrcYS oisWPpRF0mIoqaB3nTOiQa1IQX/WGMsBYBrdwVwSERoR/LRgDHze4B3hcihOvTkRJJNW 8iw+mcojutT6UvtOTMkiIPNcEbQtkOxzvgjfYQtIH2iHV7cpeKE5xe2rezED7YqcaTtw iWjY6J6J6NEQa+8IZGm7GZubqtBiddXxP//c0KCaBtJAOaQGDlEeWRxtx4vFDeXx2X16 BVpA== X-Gm-Message-State: APjAAAX4Z9yjPc2Fc/jiPh3+oNZX8dtW6sRH3IuV3+cjK7Rn4dLQs+s2 mSMuEDJUTLa4Z2kUx+F0kYlzx1z7 X-Google-Smtp-Source: APXvYqzOVP+YdPx1xN7Ljt3eqYruHlN59Ts1Iz4QlLBZf4eB3n0TvvNbAwqc34au1uvGg1wlVpKtqg== X-Received: by 2002:a17:90a:bf81:: with SMTP id d1mr2808326pjs.125.1574820562290; Tue, 26 Nov 2019 18:09:22 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id s26sm13935204pfh.66.2019.11.26.18.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 18:09:21 -0800 (PST) Date: Tue, 26 Nov 2019 18:09:19 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger Subject: [PATCH 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 format-patch the `--no-base` option which overrides `format.useAutoBase`. Signed-off-by: Denton Liu --- Documentation/git-format-patch.txt | 5 +++-- builtin/log.c | 24 +++++++++++++++++++++--- t/t4014-format-patch.sh | 6 ++++++ 3 files changed, 30 insertions(+), 5 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..c017df4056 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1388,6 +1388,23 @@ static int from_callback(const struct option *opt, const char *arg, int unset) return 0; } +static int base_callback(const struct option *opt, const char *arg, int unset) +{ + char **base_commit = opt->value; + + free(*base_commit); + + if (unset) { + base_auto = 0; + *base_commit = NULL; + } else if (arg) { + *base_commit = xstrdup(arg); + } else { + BUG("arg is NULL"); + } + return 0; +} + struct base_tree_info { struct object_id base_commit; int nr_patch_id, alloc_patch_id; @@ -1676,10 +1693,11 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) PARSE_OPT_OPTARG, thread_callback }, OPT_STRING(0, "signature", &signature, N_("signature"), N_("add a signature")), - OPT_STRING(0, "base", &base_commit, N_("base-commit"), - N_("add prerequisite tree info to the patch series")), + { OPTION_CALLBACK, 0, "base", &base_commit, N_("base-commit"), + N_("add prerequisite tree info to the patch series"), + 0, base_callback }, OPT_FILENAME(0, "signature-file", &signature_file, - N_("add a signature from a file")), + N_("add a signature from a file")), OPT__QUIET(&quiet, N_("don't print the patch filenames")), OPT_BOOL(0, "progress", &show_progress, N_("show progress while generating patches")), 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 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