From patchwork Sat Oct 17 23:15:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Samuel_=C4=8Cavoj?= X-Patchwork-Id: 11843165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE1A1C43457 for ; Sat, 17 Oct 2020 23:16:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 96A9B212CC for ; Sat, 17 Oct 2020 23:16:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cavoj.net header.i=@cavoj.net header.b="ZCCXG0KK"; dkim=pass (1024-bit key) header.d=cavoj.net header.i=@cavoj.net header.b="AhnLdcFl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439938AbgJQXQJ (ORCPT ); Sat, 17 Oct 2020 19:16:09 -0400 Received: from lithium.sammserver.com ([168.119.122.30]:33522 "EHLO lithium.sammserver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439930AbgJQXQH (ORCPT ); Sat, 17 Oct 2020 19:16:07 -0400 Received: from mail.sammserver.com (sammserver.wg [10.32.40.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by lithium.sammserver.com (Postfix) with ESMTPS id 54083312B5AD; Sun, 18 Oct 2020 01:16:05 +0200 (CEST) Received: by mail.sammserver.com (Postfix, from userid 5011) id 0C5161120A01; Sun, 18 Oct 2020 01:16:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cavoj.net; s=email; t=1602976565; bh=QqvBo8u2Xq74KIbnT8Xajw1Dpr6aeuHc1QoaFmaZtec=; h=From:To:Cc:Subject:Date:From; b=ZCCXG0KKDHBko/h7Qddnx2isx514I/cGeLe9Whxo/SVIRSBYu4cH33yNVN01wiyNe N3OEhMAl7Y2cskms4j6pgSMb1TxIJb/iaFCPfm+zLBIyAj4k0RWAfFQPLBulYcUHFP wdTwLQhWDKcJdx2Rvlf1hFvcOD9PkR5X9q8zhW40= Received: from fastboi.localdomain (fastboi.wg [10.32.40.5]) by mail.sammserver.com (Postfix) with ESMTP id C13CF11209F9; Sun, 18 Oct 2020 01:16:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cavoj.net; s=email; t=1602976564; bh=QqvBo8u2Xq74KIbnT8Xajw1Dpr6aeuHc1QoaFmaZtec=; h=From:To:Cc:Subject:Date:From; b=AhnLdcFltM3C7fgZSwl2CjamiqwQjqN/kexphLtlfgueYx5OKcp/DTAqogm1xQ9Pi 6BR/r4ANtyO7W29y+lqAxZaVgvd1YdN8bfZjJuToFVqcBYi5CoKfxyXfcC9vSAuAgV wTfeMU+pdQbERy1CMBg4jNHi4Z2teD7Jebb/A6Bg= Received: by fastboi.localdomain (Postfix, from userid 1000) id AEC8D1420A90; Sun, 18 Oct 2020 01:16:04 +0200 (CEST) From: =?utf-8?q?Samuel_=C4=8Cavoj?= To: Junio C Hamano , git@vger.kernel.org Cc: Phillip Wood , Johannes Schindelin , "brian m. carlson" , =?utf-8?q?Samuel_=C4=8Ca?= =?utf-8?q?voj?= Subject: [PATCH v4 1/3] sequencer: fix gpg option passed to merge subcommand Date: Sun, 18 Oct 2020 01:15:55 +0200 Message-Id: <20201017231557.1001728-1-samuel@cavoj.net> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When performing a rebase with --rebase-merges using either a custom strategy specified with -s or an octopus merge, and at the same time having gpgsign enabled (either rebase -S or config commit.gpgsign), the operation would fail on making the merge commit. Instead of "-S%s" with the key id substituted, only the bare key id would get passed to the underlying merge command, which tried to interpret it as a ref. Fix the issue and add test cases as suggested by Johannes Schindelin and Junio C Hamano. Signed-off-by: Samuel Čavoj --- changed v3 -> v4: - added explicit test_unconfig to test case - use git config instead of test_config - added one more test case --- sequencer.c | 2 +- t/t3435-rebase-gpg-sign.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/sequencer.c b/sequencer.c index 00acb12496..88ccff4838 100644 --- a/sequencer.c +++ b/sequencer.c @@ -3677,7 +3677,7 @@ static int do_merge(struct repository *r, strvec_push(&cmd.args, "-F"); strvec_push(&cmd.args, git_path_merge_msg(r)); if (opts->gpg_sign) - strvec_push(&cmd.args, opts->gpg_sign); + strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign); /* Add the tips to be merged */ for (j = to_merge; j; j = j->next) diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh index b47c59c190..a2b7625707 100755 --- a/t/t3435-rebase-gpg-sign.sh +++ b/t/t3435-rebase-gpg-sign.sh @@ -68,4 +68,25 @@ test_expect_failure 'rebase -p --no-gpg-sign override commit.gpgsign' ' test_must_fail git verify-commit HEAD ' +test_expect_success 'rebase -r, merge strategy, --gpg-sign will sign commit' ' + git reset --hard merged && + test_unconfig commit.gpgsign && + git rebase -fr --gpg-sign -s resolve --root && + git verify-commit HEAD +' + +test_expect_success 'rebase -r, merge strategy, commit.gpgsign=true will sign commit' ' + git reset --hard merged && + git config commit.gpgsign true && + git rebase -fr -s resolve --root && + git verify-commit HEAD +' + +test_expect_success 'rebase -r, merge strategy, commit.gpgsign=false --gpg-sign will sign commit' ' + git reset --hard merged && + git config commit.gpgsign false && + git rebase -fr --gpg-sign -s resolve --root && + git verify-commit HEAD +' + test_done From patchwork Sat Oct 17 23:15:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Samuel_=C4=8Cavoj?= X-Patchwork-Id: 11843161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C78D5C433E7 for ; Sat, 17 Oct 2020 23:16:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A87121582 for ; Sat, 17 Oct 2020 23:16:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cavoj.net header.i=@cavoj.net header.b="PQw55p3E"; dkim=pass (1024-bit key) header.d=cavoj.net header.i=@cavoj.net header.b="PQw55p3E" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439936AbgJQXQH (ORCPT ); Sat, 17 Oct 2020 19:16:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439929AbgJQXQH (ORCPT ); Sat, 17 Oct 2020 19:16:07 -0400 Received: from lithium.sammserver.com (lithium.sammserver.com [IPv6:2a01:4f8:c2c:b7df::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2075C061755 for ; Sat, 17 Oct 2020 16:16:06 -0700 (PDT) Received: from mail.sammserver.com (sammserver.wg [10.32.40.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by lithium.sammserver.com (Postfix) with ESMTPS id 69A90312B5AE; Sun, 18 Oct 2020 01:16:05 +0200 (CEST) Received: by mail.sammserver.com (Postfix, from userid 5011) id 2C1F61120A09; Sun, 18 Oct 2020 01:16:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cavoj.net; s=email; t=1602976565; bh=7QNB61HXXKIL1KQAHXjHPiYq9NjlksGH5yiqpPrxm2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PQw55p3EqtUSuK7P4c41/JBao/3UW5jCn7363+AI3hTYUoGzv/lRGUVSySFnipun4 px5291ObCXc4lrpsjsl6M4plCgIPKP0iknChe3PoFdH2fpvTFvZb3K2TBla7BeOvw6 ORlBF8paS6wsP5luALYk6mUpGWT+rvCFxMkAlYQ8= Received: from fastboi.localdomain (fastboi.wg [10.32.40.5]) by mail.sammserver.com (Postfix) with ESMTP id C5EC511209FB; Sun, 18 Oct 2020 01:16:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cavoj.net; s=email; t=1602976565; bh=7QNB61HXXKIL1KQAHXjHPiYq9NjlksGH5yiqpPrxm2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PQw55p3EqtUSuK7P4c41/JBao/3UW5jCn7363+AI3hTYUoGzv/lRGUVSySFnipun4 px5291ObCXc4lrpsjsl6M4plCgIPKP0iknChe3PoFdH2fpvTFvZb3K2TBla7BeOvw6 ORlBF8paS6wsP5luALYk6mUpGWT+rvCFxMkAlYQ8= Received: by fastboi.localdomain (Postfix, from userid 1000) id B34231420A8F; Sun, 18 Oct 2020 01:16:04 +0200 (CEST) From: =?utf-8?q?Samuel_=C4=8Cavoj?= To: Junio C Hamano , git@vger.kernel.org Cc: Phillip Wood , Johannes Schindelin , "brian m. carlson" , =?utf-8?q?Samuel_=C4=8Ca?= =?utf-8?q?voj?= Subject: [PATCH v4 2/3] sequencer: pass explicit --no-gpg-sign to merge Date: Sun, 18 Oct 2020 01:15:56 +0200 Message-Id: <20201017231557.1001728-2-samuel@cavoj.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201017231557.1001728-1-samuel@cavoj.net> References: <20201017231557.1001728-1-samuel@cavoj.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The merge subcommand launched for merges with non-default strategy would use its own default behaviour to decide how to sign commits, regardless of what opts->gpg_sign was set to. For example the --no-gpg-sign flag given to rebase explicitly would get ignored, if commit.gpgsign was set to true. Fix the issue and add a test case excercising this behaviour. Signed-off-by: Samuel Čavoj --- sequencer.c | 2 ++ t/t3435-rebase-gpg-sign.sh | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/sequencer.c b/sequencer.c index 88ccff4838..043d606829 100644 --- a/sequencer.c +++ b/sequencer.c @@ -3678,6 +3678,8 @@ static int do_merge(struct repository *r, strvec_push(&cmd.args, git_path_merge_msg(r)); if (opts->gpg_sign) strvec_pushf(&cmd.args, "-S%s", opts->gpg_sign); + else + strvec_push(&cmd.args, "--no-gpg-sign"); /* Add the tips to be merged */ for (j = to_merge; j; j = j->next) diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh index a2b7625707..2fba21f77a 100755 --- a/t/t3435-rebase-gpg-sign.sh +++ b/t/t3435-rebase-gpg-sign.sh @@ -89,4 +89,11 @@ test_expect_success 'rebase -r, merge strategy, commit.gpgsign=false --gpg-sign git verify-commit HEAD ' +test_expect_success "rebase -r, merge strategy, commit.gpgsign=true --no-gpg-sign won't sign commit" ' + git reset --hard merged && + git config commit.gpgsign true && + git rebase -fr --no-gpg-sign -s resolve --root && + test_must_fail git verify-commit HEAD +' + test_done From patchwork Sat Oct 17 23:15:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Samuel_=C4=8Cavoj?= X-Patchwork-Id: 11843163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A05C4C433DF for ; Sat, 17 Oct 2020 23:16:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C8BE214DB for ; Sat, 17 Oct 2020 23:16:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cavoj.net header.i=@cavoj.net header.b="WS4/lEKx"; dkim=pass (1024-bit key) header.d=cavoj.net header.i=@cavoj.net header.b="lcV9FHjB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439933AbgJQXQH (ORCPT ); Sat, 17 Oct 2020 19:16:07 -0400 Received: from lithium.sammserver.com ([168.119.122.30]:33510 "EHLO lithium.sammserver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439929AbgJQXQG (ORCPT ); Sat, 17 Oct 2020 19:16:06 -0400 X-Greylist: delayed 4417 seconds by postgrey-1.27 at vger.kernel.org; Sat, 17 Oct 2020 19:16:06 EDT Received: from mail.sammserver.com (sammserver.wg [10.32.40.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by lithium.sammserver.com (Postfix) with ESMTPS id 50FF3312B5AC; Sun, 18 Oct 2020 01:16:05 +0200 (CEST) Received: by mail.sammserver.com (Postfix, from userid 5011) id 098E311209FF; Sun, 18 Oct 2020 01:16:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cavoj.net; s=email; t=1602976565; bh=JSWsXvYFer7QVagEfPMHu7EjECEu0gBfEk3TAFh1IQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WS4/lEKxVxcDeYea3BlUnwYLuhTOBdBFjKxdcU+ZwykoDODyuhVqvllM9frPigS4H JPW/okCoEVZXTUt7KpCN4GQDDeGGXykNmryfIhukbf/8CStVtuEH5SDsYmBOAIviTj ALg+fbKKgVUYJRlQ73HkzOb+b37Xmet7ElhHgjXU= Received: from fastboi.localdomain (fastboi.wg [10.32.40.5]) by mail.sammserver.com (Postfix) with ESMTP id C31B511209FA; Sun, 18 Oct 2020 01:16:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cavoj.net; s=email; t=1602976564; bh=JSWsXvYFer7QVagEfPMHu7EjECEu0gBfEk3TAFh1IQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lcV9FHjB9E8tGhi52tka1evcIoWdzxV5PHIWxx+d3T0wj1XYqh+RX6iiy0MZ3eZCY 8Xcw6Xpz8smau5iB6bcISj+Pr6dQJTkDX3daAW4TzMDmK3VGOYLyS0xid/jRz8k5sR 2r0wxgV3dwVIyxXnPcGytTME4j1EVfmMoViQm9b0= Received: by fastboi.localdomain (Postfix, from userid 1000) id B90051420A92; Sun, 18 Oct 2020 01:16:04 +0200 (CEST) From: =?utf-8?q?Samuel_=C4=8Cavoj?= To: Junio C Hamano , git@vger.kernel.org Cc: Phillip Wood , Johannes Schindelin , "brian m. carlson" , =?utf-8?q?Samuel_=C4=8Ca?= =?utf-8?q?voj?= Subject: [PATCH v4 3/3] t3435: add tests for rebase -r GPG signing Date: Sun, 18 Oct 2020 01:15:57 +0200 Message-Id: <20201017231557.1001728-3-samuel@cavoj.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201017231557.1001728-1-samuel@cavoj.net> References: <20201017231557.1001728-1-samuel@cavoj.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add test cases of various combinations of the commit.gpgsign option and --gpg-sign, --no-gpg-sign flags with rebase -r with the default merge strategy. This excercises a different code-path from those with octopus merges or overridden merge strategy with rebase -s. Signed-off-by: Samuel Čavoj --- changed v3 -> v4: * new --- t/t3435-rebase-gpg-sign.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh index 2fba21f77a..54120b09d6 100755 --- a/t/t3435-rebase-gpg-sign.sh +++ b/t/t3435-rebase-gpg-sign.sh @@ -96,4 +96,32 @@ test_expect_success "rebase -r, merge strategy, commit.gpgsign=true --no-gpg-sig test_must_fail git verify-commit HEAD ' +test_expect_success 'rebase -r --gpg-sign will sign commit' ' + git reset --hard merged && + test_unconfig commit.gpgsign && + git rebase -fr --gpg-sign --root && + git verify-commit HEAD +' + +test_expect_success 'rebase -r with commit.gpgsign=true will sign commit' ' + git reset --hard merged && + git config commit.gpgsign true && + git rebase -fr --root && + git verify-commit HEAD +' + +test_expect_success 'rebase -r --gpg-sign with commit.gpgsign=false will sign commit' ' + git reset --hard merged && + git config commit.gpgsign false && + git rebase -fr --gpg-sign --root && + git verify-commit HEAD +' + +test_expect_success "rebase -r --no-gpg-sign with commit.gpgsign=true won't sign commit" ' + git reset --hard merged && + git config commit.gpgsign true && + git rebase -fr --no-gpg-sign --root && + test_must_fail git verify-commit HEAD +' + test_done