From patchwork Wed Dec 4 07:47:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11272215 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 56C8F17EF for ; Wed, 4 Dec 2019 07:48:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 334A620637 for ; Wed, 4 Dec 2019 07:48:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eLzouHg7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726679AbfLDHrz (ORCPT ); Wed, 4 Dec 2019 02:47:55 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:42365 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfLDHry (ORCPT ); Wed, 4 Dec 2019 02:47:54 -0500 Received: by mail-pl1-f196.google.com with SMTP id x13so2803582plr.9 for ; Tue, 03 Dec 2019 23:47:54 -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=LZjBfy1fxChr+CvrWi2FuH41XlOVip8CW43YiSem9cM=; b=eLzouHg7AM4l7N7NrNaszYeCKYMpStSUIior6NCtj/1L285C7ghsJh+5mo2eYg9YSi YT28keLnDEi/3EoS0XZSLXkjCWJfP0Lg0TA0GfVCGeyL8OJiMCc7WUALUa7a/XuDHAEA EByDMPYBbsZ/DIlQHSvkUn5nG012DJ3zEFS1RtU3zqIrxXj3+IaxPYdtTeNcRCmc7PlH LxLOYs75OgeT+VhLp5V4aPGH7AFit4YxnHPBvz0f7MMtuYsfPSfsFgfSxqy0/7qpVQ/o sxGXH4v9vQ75WXQ4jhZ6gobhi7Zaq11GytOgk0r0yPcMkJlaf9h91P4WCvVgsQ7DCRqo x1vg== 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=LZjBfy1fxChr+CvrWi2FuH41XlOVip8CW43YiSem9cM=; b=k2MFezvmca71+0clnSUVafYss0jSbKjuLbCwZjG5KLWO0q6kLkhgBi6P+7YvfxyCJP K9EhvhGN95ocqGlvA3QRSbuoHI25V2zZwRcOPD8xhpDxHxMf/EfDVpQV8jloPBKTHkDQ CHrHSAX4m/ZS5IEjcDylqo4AHibkKdPHtgRcH/uI5DCm1u2x0ooCUcSEc2j6OtbP0TgC mfimNbZG6NpIHAYP+sjG5MWevl1M+W1wJvgFkg14NxN5FPfdakKdIz8rtpTGAGQqKgq2 GYyGBPpGcOmlszGo4DVe2GSWftjcfQ/QtJC0QoB3SD+fMdevvKg0Xd3c1nM3+5zepKXQ lU6Q== X-Gm-Message-State: APjAAAXZCgYYRIaVVfxonIcvUogW0DKyOKnArTkMwFiTqVSS+GxMHMZY jJ6DkYUavqszKSkPkfXjc1OBiTN1 X-Google-Smtp-Source: APXvYqxCRwOXujwJzYB9kTtpx2rkVJdLBsCuTdfXPocZ6aJi/T/3viOaqWp+qw3aB7T8vz8krc14ag== X-Received: by 2002:a17:902:b691:: with SMTP id c17mr2007737pls.252.1575445673533; Tue, 03 Dec 2019 23:47:53 -0800 (PST) Received: from generichostname ([2601:646:280:1b30:b0bc:639f:d5c8:2bcf]) by smtp.gmail.com with ESMTPSA id 186sm6667713pfe.141.2019.12.03.23.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 23:47:53 -0800 (PST) Date: Tue, 3 Dec 2019 23:47:51 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 1/5] t3400: demonstrate failure with format.useAutoBase Message-ID: <8d67bbe5bfb7b09dff9687a06acb92fbf8202699.1575445583.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 Dec 4 07:47:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11272217 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 8B6BF184E for ; Wed, 4 Dec 2019 07:48:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5EBCC20637 for ; Wed, 4 Dec 2019 07:48:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CPuMzm0j" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727009AbfLDHr5 (ORCPT ); Wed, 4 Dec 2019 02:47:57 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42807 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfLDHr5 (ORCPT ); Wed, 4 Dec 2019 02:47:57 -0500 Received: by mail-pf1-f193.google.com with SMTP id l22so3203165pff.9 for ; Tue, 03 Dec 2019 23:47:56 -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=CPuMzm0jHswvQHVuQ/D5u0DU6LJ4TVCAhpkg3782Y13IhXAlHz6ngZyHztXuCbhZ7B jC6Ka9Xy5+RRWXVTMFd7zTUADwhmujYCDtKxvks6JFP21oSjhGioIkzy+BFpYuGCorNv 1S7lA2JfIgzEUA5AVJGvcwDV3aVDSj2s7WOFbzk2FNdnap68uKR/kDD1E5qziseHCero twqFAarPgL2VvLCO92mRuBmneF3hBaxsAHtQC6I4XqlfWPpAOWjmBgiFfYMJ1wKiCLP3 r2J2x3cdbFYzBABUgIV+sdlOrRWCQ5VtPoRRjI9XnnR7QCMDjf82eAyK+imdZk3YM1cr Xydg== 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=TgrIf7Xd4ryeW3myf6jlhSalRIOkfbch3EeXHFZDmMcizmu9PGmMwhQER2ijsK3aQw PI+PySKg/eDoDXt6+60NQUho6Qa3Opgir3qQreSNVuYTEcFGF4wBqDpaI2zyWEW8VwH8 b2RL9+VJSOgZM414LPM5/9tdWugQhFbQDQ5E31iU0c0A7C/z4tPvaSsqhEBqt7b0rtmH 9o3RkccnQZDigVsbkFhXF2TYtDzchy2JsiEgYBXMbGjOXccpIRhTpmYtg3bX3G8EgKgJ CyUqDUj07tilIjF2gx0U0YHUzO2Gqs34xKEXWQXV92VNgCPSN0fdzA5SaEk+VQZMNazQ RjnQ== X-Gm-Message-State: APjAAAW3yeQKk2qIDZlsLKGhN8hV7v4fNPPV8VIHTulxm1U2ySqO9OIv X1+PBZTF2y0Sj18R9ehOYKa5F4qe X-Google-Smtp-Source: APXvYqwDLg/7WAc79V4nGaYToAduyDqGCFYe2RTbc5lyLmFEKyr6B2yKCXq7tdrL9/u7sDFnSSU47g== X-Received: by 2002:a63:201b:: with SMTP id g27mr2114192pgg.56.1575445676132; Tue, 03 Dec 2019 23:47:56 -0800 (PST) Received: from generichostname ([2601:646:280:1b30:b0bc:639f:d5c8:2bcf]) by smtp.gmail.com with ESMTPSA id g191sm6720695pfb.19.2019.12.03.23.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 23:47:55 -0800 (PST) Date: Tue, 3 Dec 2019 23:47:54 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 2/5] format-patch: fix indentation Message-ID: <8cfde9f98e416aa44bc27e71d200990fd4d83ae6.1575445583.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 07:47:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11272221 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 2453D6C1 for ; Wed, 4 Dec 2019 07:48:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0123420637 for ; Wed, 4 Dec 2019 07:48:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AIBOgq2l" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727119AbfLDHr7 (ORCPT ); Wed, 4 Dec 2019 02:47:59 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:38780 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfLDHr7 (ORCPT ); Wed, 4 Dec 2019 02:47:59 -0500 Received: by mail-pl1-f196.google.com with SMTP id o8so2817505pls.5 for ; Tue, 03 Dec 2019 23:47:59 -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=AIBOgq2lBrPYsrDTtTaiEQrfhLciwYSb+XNUIpi3tLcAIB70xVTWTxrzl2sHbCRX3u yXz0YXlnKUFoHdycv46fRlzZZXmPx/HmvrnMbR8cwYFCE33wT9cnbiFvT0RoDR+Jigfr dMfyjMUI9T+beEpj1TZKH1a2maQ+x1iMPACG5mykttvz+lBOpX5JxHTJ+CRInnLzp32o 1ngRyushz5dENHW3bQZCI6I7/VVeLj3jrrieqpA5s9hQGt4prUYq7XHSUvZKjRIMiFHW 4B2j//B7v671oLEYyctrJ3SDDdGMw7gic/vDeOp3a8RAy0GGOSJXhoIObphrhmpPYNp8 NObQ== 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=ed8ybOujRkInUDYd9iOL0FfrziWUgV9nR8su8stSSPbAyDasbkS8uvJ6kDYvbuKYBf y+N8bES0mMsIaXI0rBORbRSDQ6t4KqpJM8Q0UPsZwF96wG+0TCehRVly8yVgdcLFrqTI 7ob9d4VOq5m954DN6rbn/+AYZhWhZth59NL+LZGcwj7ESiVrF8QNZ2wxlfnDrn3ws/5N aEJwKW9YcKUVwDVxIJVXDHD/kR3BDvoxoA0JGW17pRw97syqOrm4c3tEiENwr3XihVRW rJ5/qLF8dADWeCPIBs7YqKCjmhVmnpr/OQy2/83otxbvuQnYAjdT1GjnDETd1N8o/owh 8j3g== X-Gm-Message-State: APjAAAXOwxiCd2ibqGzKyl/v56JDGiMBLa7LEXW/gdsek7SuxreC7lBr MHVWRrqbqiHEPZNGkYc8mo2dTfZF X-Google-Smtp-Source: APXvYqyyBU1jlUUkilpujWkSpWFcu9h2svVy5kFeasCnd84aZG65XO7SFkuHL89x/Fcpej4AeBKHmg== X-Received: by 2002:a17:902:7c0c:: with SMTP id x12mr2121288pll.239.1575445678592; Tue, 03 Dec 2019 23:47:58 -0800 (PST) Received: from generichostname ([2601:646:280:1b30:b0bc:639f:d5c8:2bcf]) by smtp.gmail.com with ESMTPSA id y144sm7240937pfb.188.2019.12.03.23.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 23:47:58 -0800 (PST) Date: Tue, 3 Dec 2019 23:47:56 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 3/5] t4014: use test_config() Message-ID: <638c4add00657daa9b7a4fa50882053335d5caef.1575445583.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 Dec 4 07:47:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11272223 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 4F54517EF for ; Wed, 4 Dec 2019 07:48:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C3AA20659 for ; Wed, 4 Dec 2019 07:48:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pIXnPH8R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727149AbfLDHsC (ORCPT ); Wed, 4 Dec 2019 02:48:02 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:33893 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfLDHsC (ORCPT ); Wed, 4 Dec 2019 02:48:02 -0500 Received: by mail-pf1-f196.google.com with SMTP id n13so3225065pff.1 for ; Tue, 03 Dec 2019 23:48: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=4ry4whkvr4bRo1jUw3sUAXZ/RJQh+nTemy5Pw4b44GA=; b=pIXnPH8Rt8qVpgrJv5DWkHcU33XstPuZM8q35/hsxedMDe2/paHXm6EM3ZTCF/0pQ7 vsRfkeluU6IfDzsAFE3RQCyzxYXS04dV7OS3dMcvEzdXGV5yT+fBwyUJ2rRUMBm96eTS EercnhUbuPACHAEB82S5LlERZjVVZt1ppamVZttxh6vFy8W1Xm5K/h7Wz23rRVyS7CP/ p3DfhEcRffeUDZU4bBHcbvb4VDZOcrDjbH+jn9456NP2vn+e7kmaP1Z2YVC4trpIH8Y8 v7l7NiZXAYoJ5LRrh1LNiB6fJrfPNSblxV44KZ2u+Yfcis6AA1shUySeUWnB2A4uv1V0 oDzw== 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=4ry4whkvr4bRo1jUw3sUAXZ/RJQh+nTemy5Pw4b44GA=; b=JAWEkS41SCOYuRa902+9GhdR8WlhoiSM3LJM88yvzF4rF6EncRtjMNy2lTKMbnmljU QtqaxgDlNX/0s/NTDsA8oJQJGrghgLcOqYkMISDfeenjEFjcWOUpJBkBqjAwynhzz4Lu fi4JcKvANxgs0SRRkDbum5LPDw426z3LMftmzRjV4s8jOzU85Y1Upr7oDQHtWKSvHlWb i976dBKXyto8/lyRj1H/Fdj4wIoVdlWzCrkYDDCmdKSFMI0Ks8nui0KtYAQLi2o+V1Yt psSOzI9oul/wnXW73N3IKfOh/R6yBs98bdqdgS81Nh/X1BrWb6GBWfFaFOWRmIWC7Lxb JlKQ== X-Gm-Message-State: APjAAAUaAhok0oYGJiMDWUODbYVOMiSrFcapoPBHxsxkEY9k0EDsjlEe Ik6AiaoZztcOy5H5wbtaYnhcPUii X-Google-Smtp-Source: APXvYqw9vRV+PSzFZOK4OEZ4zarYrPnJctocDEUXrKxUe3CjcrqLUifCoxbvezrMa56VV/A6mZKb6w== X-Received: by 2002:a63:b26:: with SMTP id 38mr2100106pgl.116.1575445681222; Tue, 03 Dec 2019 23:48:01 -0800 (PST) Received: from generichostname ([2601:646:280:1b30:b0bc:639f:d5c8:2bcf]) by smtp.gmail.com with ESMTPSA id z29sm6360672pge.21.2019.12.03.23.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 23:48:00 -0800 (PST) Date: Tue, 3 Dec 2019 23:47:59 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 4/5] format-patch: teach --no-base Message-ID: <6cba51ca247423c76bda498152c162900aba1b59.1575445583.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 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 | 22 ++++++++++++++++++++-- t/t4014-format-patch.sh | 6 ++++++ 3 files changed, 29 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..645d6db7cc 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,8 +1693,9 @@ 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")), OPT__QUIET(&quiet, N_("don't print the patch filenames")), 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 07:48:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11272225 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 84B63184E for ; Wed, 4 Dec 2019 07:48:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5777020659 for ; Wed, 4 Dec 2019 07:48:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gPY/qntd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727177AbfLDHsF (ORCPT ); Wed, 4 Dec 2019 02:48:05 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:33029 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfLDHsE (ORCPT ); Wed, 4 Dec 2019 02:48:04 -0500 Received: by mail-pg1-f193.google.com with SMTP id 6so2972742pgk.0 for ; Tue, 03 Dec 2019 23:48:04 -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=m95ZEd8SQdN1wYtZUTVcXRr1rDSCXSexJ4dYAIiyEBc=; b=gPY/qntdwQ2yEsFO3tSnG7LwNCbPHpHeO0vOvYm1hq3bE3rh3sL2CVH7kjOoQpUANQ 1KnEa7JdjptHd5zDbftQaShoCv9RJRstcdgFPf7MhfkpdMDqSRu6UeUefRpeAIKrPXUZ eTHcd7b9D31ojJvicG7ITpedn9/qQJWNHzacya0CPpjJMHPCBQHjdKz7yyhZbecwEpOG YzsDv+5G9kd1oGiSnuwh2HTtsGC8e3iMIDrzyQkcgcE3HOQVilCBrB2mwahuKcWZ1b6f FOUlZHB0EEJHQvjoR1YTcg8KzHkREm/P0ArsMVlS7ju4M6jidrjhdazzrVx8RFV4M5or 5wqw== 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=m95ZEd8SQdN1wYtZUTVcXRr1rDSCXSexJ4dYAIiyEBc=; b=KhAD8s28pn4nGrEZx8Y+xn4WGFOyonT7cJjur30RGToKLrKGDIbVL/afiz+Layx8iU vzKDFm2C97DMOAPP3XilcJol/fnRLHj9mwRYkkaVSaq0cnTXUlHlvKgKb9ee6zrlDjNk YS22sslrXnl+4U3HBkiK8bbdcM5wNrQm68j9GNo554hqoyg/XHNcoA80RHwyX5axiYzr 4uRTwVENeOkKQpsDycf6ZP5x52zgPLXiEI38eEUDC/cxXH/m/KzbSSjuaXI89qTcZDLL cFlwmnTiSoI1P48pyI3xczc06YB2pwKPqFZu84mleb4WdzDqlDpO1boghq0Ye/aYL+XE pEXQ== X-Gm-Message-State: APjAAAX/y66aXGYGDRUjrtHOzBvh2MYfThLDXMzBGgfM3OpX3ekflOiP toebPVSYy+F4HJZ1LSg9h8lGnZFI X-Google-Smtp-Source: APXvYqxwbF1TGIEvjFkxRpbqdXxV03DmCQ+LpsUhcX18zUcjoIuaRnFRgOJCgBxfqS8wDs9r6cDe9Q== X-Received: by 2002:a65:4c06:: with SMTP id u6mr2141826pgq.412.1575445683827; Tue, 03 Dec 2019 23:48:03 -0800 (PST) Received: from generichostname ([2601:646:280:1b30:b0bc:639f:d5c8:2bcf]) by smtp.gmail.com with ESMTPSA id 20sm5887430pgw.71.2019.12.03.23.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 23:48:03 -0800 (PST) Date: Tue, 3 Dec 2019 23:48:01 -0800 From: Denton Liu To: Git Mailing List Cc: Christian Biesinger , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 5/5] rebase: fix format.useAutoBase breakage 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 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