From patchwork Wed Nov 27 18:13:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11264669 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 D73C313A4 for ; Wed, 27 Nov 2019 18:13:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B62B020835 for ; Wed, 27 Nov 2019 18:13:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TgJKd67y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727090AbfK0SNm (ORCPT ); Wed, 27 Nov 2019 13:13:42 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:47084 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbfK0SNm (ORCPT ); Wed, 27 Nov 2019 13:13:42 -0500 Received: by mail-pj1-f68.google.com with SMTP id a16so10362540pjs.13 for ; Wed, 27 Nov 2019 10:13:42 -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=I6Kso95AXyCk2GNDiPAC3kfGna2SOXjNCHBQZmZiwKQ=; b=TgJKd67ycRzDTQVSN9D3j4tAyuDfyvxxA7oh072iOKuYQw1MJq+favcc6snwxzSoOb OB+jpJltc4XN8NrBYM8cH2jK4FJ/LfZ/dWxNwd1pNPhHYQgwRrR9R8/Ipg++DXlM+vzO szPdrOnqyVG1u4kpggl8kzJyR/8aUhWfbxV7SFmNeWEHLyxguf/PCLGAjRA/zhs9xM2M vXvtX2FTwBr91UqSB2INrAz7qnf3rG42a5wh3V3IE/KZRF7aEmdjNBzfG1w1NWpZB9t1 4nKLYDsSxaTwIXL0jMCEJwn9AL8U7zCETZb/PrkyIbXcm1VlR3+skUzWHrOONFDA381m M3/Q== 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=I6Kso95AXyCk2GNDiPAC3kfGna2SOXjNCHBQZmZiwKQ=; b=Jfly5J+4ndYEGgg+Kz51FwJ1GE/jbuts+7ACKIZJpXb3cQ3DUOLyUWtXXqmGk59znq SxYl7JfRtt0BaBf8yaGZfTnlCR/BiO1m8EodSgRoG7OtwCmwuxBl9YkEdLxVKotoW/Q1 Nxnte66ly6O5TLo/dZu631BAWIixA/Yj5AWXB+nBUlArDbukDxBqSuMHchyRLcO1SplC msbtS9CJ2R5U9CN4vyUQJUPHQ6jHT/qupA0pDzmYiHadFNk53bKUM52XywSK9PvUsRL7 CfhgPnzX0pIlt8UTZQll2G7Ftbt10AC8ZEfUpc343sSmpfiYr0okBBqfnmMLR1e2rJ0C EoxA== X-Gm-Message-State: APjAAAVNgMgntju0XMzvfrRj9ka/OgMn6TNUA6yLKM5xhARNI62bqpcQ Qo6M5SL+pCd5eVrRhuiiRHbM3s+m X-Google-Smtp-Source: APXvYqyNxXomeLEmJtb49TPwZcoh3E7gi1VTg4fsNdCXorTnvXWl7CyF88/7U/y2TLNsUCxF+3xrnA== X-Received: by 2002:a17:902:4a:: with SMTP id 68mr5634893pla.158.1574878421616; Wed, 27 Nov 2019 10:13:41 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id 136sm17710110pfb.49.2019.11.27.10.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2019 10:13:41 -0800 (PST) Date: Wed, 27 Nov 2019 10:13:39 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine Subject: [PATCH v2 1/5] t3400: demonstrate failure with format.useAutoBase Message-ID: <4089e51041a9cbd15e62882c370ed254d8e63cfd.1574878089.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 that doesn't have an upstream 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. 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 18:13:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11264673 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 55B2413A4 for ; Wed, 27 Nov 2019 18:13:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A2A6207DD for ; Wed, 27 Nov 2019 18:13:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ml+6WEKn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727111AbfK0SNp (ORCPT ); Wed, 27 Nov 2019 13:13:45 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:37318 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbfK0SNo (ORCPT ); Wed, 27 Nov 2019 13:13:44 -0500 Received: by mail-pg1-f193.google.com with SMTP id b10so11282016pgd.4 for ; Wed, 27 Nov 2019 10:13:44 -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=Ml+6WEKnvPoQ6pgOdQqvTgwpLTlonDBl+MHg+YoJmDL0EzlJ5oKQDwYTUHqwR1Jnro m3Um4VEDQTd0xE6330EO+kJ0wZxzvXFGAGt8i78H4/9bNaYAmuiiaPUP5DxwdQMYRoE0 LO5G3T/0JFFqiovE+LClIu6gicNVQzyFmE1ktdm7qhBjXlCafjhRdojcUm6fKW9JXhS6 HCv7CTI+buCck6oS6htV+zf7hOEzmtJGuGopr2Gi4Hw82lp/j+QU2+oMTNUL5w/iVTTp LE4EUv+sMqm7YVxtgj6dgHYq/kl4g6CGN4jcAkNrSyAR9RfOBTgnYXdfqjwl8KMyVHwV rmlA== 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=TuAuyG/uayNd1BJ0cPKF3sm5J/sb8s8OZXFYcScrNTzmt75ndMbLd/f4wsMYyczXF6 m4nD+S4ij0x1LSRGk/CeLbo6YMB70vcFxkH4EIXhJepd5Zrb/2oZSUu4ctLMV4UTFrGr d7NLBFUnnm1GB8O3hO5prbuU32Qas+FSRj0RRrGH3nGoSJTnAl3UT+h8IRJ0xGjHF8c1 G7JPk9G/yLggNFZ8ubu9TtkxlvZJYnoV8z68ODyd8gSuFO0sqPzmRz56BTItCvy8Wua4 ubdQ2zrvRYw52VHweL8ncFn0O2fLiHESjJ0hT9NLN7OMOqlgT0StGaZsxmZosyUJh90T hjrg== X-Gm-Message-State: APjAAAWtxfOgbaJejJFNcvDsycnMtz7bMfZEdlV+rSSnLHnNq4hwANDL SNxol4mjE6CseEcY/a355KAPhXuh X-Google-Smtp-Source: APXvYqyG0RqUYb9mQaPLn2V8z+Vvb1YOBVqbuERVbGrGgsIu5d0GbWDZrE26H7TLzEyWvOMxHwQ41A== X-Received: by 2002:aa7:9f08:: with SMTP id g8mr49682001pfr.59.1574878423942; Wed, 27 Nov 2019 10:13:43 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id e59sm8626724pjk.28.2019.11.27.10.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2019 10:13:43 -0800 (PST) Date: Wed, 27 Nov 2019 10:13:41 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine Subject: [PATCH v2 2/5] format-patch: fix indentation 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 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 18:13:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11264677 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 D923F138C for ; Wed, 27 Nov 2019 18:13:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B8913207DD for ; Wed, 27 Nov 2019 18:13:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BR1wLHv5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727125AbfK0SNs (ORCPT ); Wed, 27 Nov 2019 13:13:48 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:33150 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbfK0SNr (ORCPT ); Wed, 27 Nov 2019 13:13:47 -0500 Received: by mail-pg1-f195.google.com with SMTP id 6so6741689pgk.0 for ; Wed, 27 Nov 2019 10:13:47 -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=bPe4LFsftv70u2OUy2/fUI40CX4aU9IvFy7Uq8RYoCM=; b=BR1wLHv5ctntw0eB917D8TQ1v3t9CnlV7sDxsAe7dlnMoWrD1WWbmiKU7UgLsvAdLH BTNgBwamfxRqv+z1qQI5PY4hxqkJ0nicp9dYrpjUgkP4dPI9X6CnQJNMVRaZGWzZr1Q1 TX6HRUteELLZYm2MfM5VgG8fs8wh4WeSwywlPx/UGWcgZsxXUMdJXdwANjAl8TnCFG8X fkeocs3FlDp88G1z+bIOGL8qAXTBUOCVu/cRAaXtqhzj5l7n6B1Q3wMd2WSLTTJ2jVlg 1Ddsxh4dqUXOfbXWXjXtnK45zWZrHm9X9hzyOk1vJAUTLntylxkw7zWYc+Hl7AE3BAtV QQtg== 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=bPe4LFsftv70u2OUy2/fUI40CX4aU9IvFy7Uq8RYoCM=; b=q/anGlpFU9baj4Oxufd6gBFeAeV9eXvIsomq0R9Ifti2FehWMv3eGfSDa1kEcLNWh4 hvGp6ECZ4i1+ilcCLjtydgJCtPOcqx5d41/QARLv1gUAZy6PeDzDgFyC+zC6iTKVponO v4Qy8BkzoK3qYyKh1J8gV0+j2y0C1rHsKmoy+IfIDhV4m7JyY10wDqmjLL3Bf8ftRJm5 xhRPsazk98eii7FRPDDQe3GmFNHiwFh7racZ6NltmTSup7eew4Zb3kF5HX7IKvjG/4Ey XzO0vBKhRGIPIs/Kr0me24Y170mo9+YnlU6/HTj4Reh18I/bgDiXwau2XyWfaqCke26U ug7Q== X-Gm-Message-State: APjAAAXofQ6SXbFn6bah+DeqcwkKTjnt69GgbcphX5iqm1RA+2/IsXyg b5Iir1WkZHbb5j6XLL5RMSI4Us3A X-Google-Smtp-Source: APXvYqySBwCVs0RxQGwn8bVB+M+5C024g3mtZ0KdKhRM571idR3fRfM1kApdAJ5sE9k0/OsXYJPrsQ== X-Received: by 2002:a63:fe4d:: with SMTP id x13mr6259279pgj.82.1574878426527; Wed, 27 Nov 2019 10:13:46 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id w138sm18187564pfc.68.2019.11.27.10.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2019 10:13:46 -0800 (PST) Date: Wed, 27 Nov 2019 10:13:44 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine Subject: [PATCH v2 3/5] t4014: use test_config() Message-ID: <196b5d8dbccfa550608c9a6c19ae4b7743089f41.1574878089.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 18:13:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11264679 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 E8FC2138C for ; Wed, 27 Nov 2019 18:13:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8E5B20835 for ; Wed, 27 Nov 2019 18:13:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fvYV3ntR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727138AbfK0SNu (ORCPT ); Wed, 27 Nov 2019 13:13:50 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42031 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbfK0SNt (ORCPT ); Wed, 27 Nov 2019 13:13:49 -0500 Received: by mail-pg1-f193.google.com with SMTP id i5so3002606pgj.9 for ; Wed, 27 Nov 2019 10:13:49 -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=fvYV3ntRfLm0hWeqiijF7YigygMcy9CLVKrL1Rf2L0/Gwko4VTl6DqZIpKNz6jzutn 7m0gTbO8eWUDLft2ZRMvZZLDFPxLE275uabYWkySlUlDyLdep0L+LS5kEovGAq+F2Pja 9Ta7c2QCw4D9nrSQJezfpVQUuc8Uj4ml3AdiJPlqfi+12oV+iQg6zGd3T9SzEuiloOqp jB/R3mtlkHWjhEfTGd8N0TacA0QTHt/nIyCko43+JQwI4eo0nw2O4I13jEMb0bMbESFS tT0gG/TYi6+y+oPHXvoH+Sp0JyzF0SR57ZDMTMdvoEeNkpjWe0plVrb1wEbzBqlw0SOw gB3w== 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=UvY5ZzJEisTmeaYLqNTyCBRWi7uhLp5PRXcuE4q6NiUsc/CMjESOULAO+g3V4fQ2oM Ar3G+K6wxhaTzI/lJYrniuqIOUUjLuk+daq/XEPC/0KWY4goKGMNrTHhNeXUISMBuqzK 3B3POY4PSEkZ9WYQPThqETQkQnKRLrKGWipd7LSqWa8zdNLspHKGS2PrDpuMlFP4JCO0 4sGQ704zgTHDE5bevYfdBBZP/KYeADtYL5qCXKjbIcE2N6HalYbIUdtRtq1JZxK4F77E yglr4UyW0R2jatbeZCPp/ofrNtgQQhHPmV1dTW1YmQaIg2DwKYXTEOKDNRMBsAVORSFP HTcg== X-Gm-Message-State: APjAAAX5iAn2nB9i9kBnuCXmXTHXApsE/PPyvoiTmJ4AGjcZZwnsSF0R l38qRonljfMpGRNWBg4j/Pjt4tva X-Google-Smtp-Source: APXvYqwTXd/Rinpc+8ONTdb0/a4eqpaHIM/26kjVQpXGz8SCIp64Z5GNiy2/hOFxv74YbU+qaLMAqw== X-Received: by 2002:a63:ed4a:: with SMTP id m10mr6448878pgk.255.1574878428738; Wed, 27 Nov 2019 10:13:48 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id p18sm17713222pff.9.2019.11.27.10.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2019 10:13:48 -0800 (PST) Date: Wed, 27 Nov 2019 10:13:46 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine Subject: [PATCH v2 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 18:13:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11264681 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 5786E13A4 for ; Wed, 27 Nov 2019 18:13:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3789D207DD for ; Wed, 27 Nov 2019 18:13:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cpy8Qq4m" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727142AbfK0SNw (ORCPT ); Wed, 27 Nov 2019 13:13:52 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45873 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbfK0SNw (ORCPT ); Wed, 27 Nov 2019 13:13:52 -0500 Received: by mail-pf1-f193.google.com with SMTP id z4so11406982pfn.12 for ; Wed, 27 Nov 2019 10:13:51 -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=4dPCuJuW+l5biFuykylkZA5uAHVBOBDlMzO4XnUQEdo=; b=cpy8Qq4mDo8EChTRAagTJWDyrGObSIjCH8oUrStmXFyE1YZGiutVpufORgun061s+Q 4ctrnWQiezmnkeR7aaDI7k7jt4I2dU/8WO3RmLXuBMAHJT3Lvv7/C4JoQxTidaJr8Euj Ep23LEyo5d03IlvrXmprsKgGfMiIot7rYogXA/nQKsDkexCds31+UrkzkPAguq0BUSOS oLYM08ZDp4nweanAh0N9yYw8Mx213lBtWFRqudKuEWU0cJU1w53fLBWL7gYFwsapMOit uZtHBHHHg82LnCX+rkZhjcKe0WO4uh6MnQY/39Zyp/eyMDv/Zsug0+WWCigfCkONmTuj 010g== 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=4dPCuJuW+l5biFuykylkZA5uAHVBOBDlMzO4XnUQEdo=; b=EYRrsYQnBQJ9aOPAe4nrmRcW9nvAA+mlLkzpWskckyUbZRCaWisDENaVoFn7RYQEE2 7cKjFWgMO2STqc//Wua92kw0WirOYjD19ZXrLUk64Y9bXEKJA5G5QZHM2QcXVK51LgoM 6aGKfyF0womxDU2GDAs9pC9fPUWBrpSJeYjFHZXw/czPSga9QFxvsfMcxKM/YMFJb25h SHKRumneYzHzmn7lmDmLpIGN9056mPE/7R7ONITqQR9otpddrR4ECUfzjTlffd0ZZ0u6 0/Jc3Txi/IgWWfa4x3smEDHnfO6Um4mDyEWPxx3ms6mh6BuaWm92ZYuEhwXXG8+BUC81 wc5w== X-Gm-Message-State: APjAAAVXocihbL3/MpaaW9d/5Uaf5lwxZta4QnfCMxD0JYa9Y4oulR55 1GATP5OHUNEavDxVpy39vVwXud2S X-Google-Smtp-Source: APXvYqyRXEKO5tcdC0mH5aGwMvofYqvaj2p6dMkUekLYdf/pqtweKX4PUpLhLJmTXBJ0M8USDOhXlg== X-Received: by 2002:a63:ec09:: with SMTP id j9mr6483928pgh.367.1574878430973; Wed, 27 Nov 2019 10:13:50 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id i13sm2905911pgr.48.2019.11.27.10.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2019 10:13:50 -0800 (PST) Date: Wed, 27 Nov 2019 10:13:48 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine Subject: [PATCH v2 5/5] rebase: fix format.useAutoBase breakage Message-ID: <62c59c12e376dd73317a7e5d78275bca12875340.1574878089.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 wasn'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