From patchwork Thu Oct 14 23:37:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12559607 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92C18C433F5 for ; Thu, 14 Oct 2021 23:37:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 75DCA60C4B for ; Thu, 14 Oct 2021 23:37:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234438AbhJNXj1 (ORCPT ); Thu, 14 Oct 2021 19:39:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234430AbhJNXjZ (ORCPT ); Thu, 14 Oct 2021 19:39:25 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B9EDC061570 for ; Thu, 14 Oct 2021 16:37:20 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id r10so23053373wra.12 for ; Thu, 14 Oct 2021 16:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ef40BbK5Y9M2u6Sp3crkei2YmJ2zBkMp8BW7pVGFLEI=; b=lhMfnaq40pAw25KEKhVLtcNLSjmbvt5YffFkKjgePcytx7N1QC+n+OzHMDg53Bq9ZP FlwXqd9WSqabr6qJYZxovMVWOhszAKO7x58D9b/YIwvqqYVnqiruhRcTuceXCnKa3Y2C 5r+SM0/fACIeFVE+XBd7ONBoBQBvyidnAjAC/CVg6Dyy8SxxFJxgT38/ZU4gOporb8yT qfp/xwFRWKkhlLw2wyLQvoru84ekcjbMBc/QuK0FznOYeVMN6Cj0Cgc67lqDEaPTzohb oVcPQlG4lgre2zZu68CVJKhRPD/om4gf0SWLJop9hx9Q0AizEP8MoLtOeUKp57zXyxId 2B0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ef40BbK5Y9M2u6Sp3crkei2YmJ2zBkMp8BW7pVGFLEI=; b=r+CamSTyInXHHPkUANWfls7lwkeJEQi8jgsdzTxIWUBi/1weH8ZpGaDJeNSAy0JEwP 6Ys7UlUILFIyn4Usnd22AFpiysF9mlu50LFZK7cvZRhN7CRjD9/ot4ezO2w6znsaDcji c2YFzZJpD8SFn2YygB1tTpjGisuHYjgpNi9BMMYmeDKtGDoGyFPrKhNBNxRWQQnO3GKb jD9zOhbPXmBrpAX9iqb2gHlrv2RvQpFg1hN1i9sD4eeFOoXQYFoaGlWOqYLjhSg/i+qd GYV9+O0XATtsRHMkK7sicXidi+hqjlRHAfCiD2IchCImKEmPQh6+J4PXxa+XHNmSbMrT 4aFA== X-Gm-Message-State: AOAM532B6coRaE4CzTtwGZQ9LmOov3wRrFBX93se42XjkHe6/zSmUXlo BPMLRKB5GLF6KJ18ZYiAjNA1mNKmiJnLQA== X-Google-Smtp-Source: ABdhPJwliZpWFtYZOcu420BVwpfHrAcOeRllIwN/HvEIflFTLw8O/0EpJEU7n3cQ3i9FKfB8gAispQ== X-Received: by 2002:a5d:6d81:: with SMTP id l1mr10317706wrs.110.1634254638524; Thu, 14 Oct 2021 16:37:18 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id g16sm3547658wrs.90.2021.10.14.16.37.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 16:37:18 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= Subject: [PATCH 1/3] commit-graph tests: fix error-hiding graph_git_two_modes() helper Date: Fri, 15 Oct 2021 01:37:14 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1338.g20da966911a In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The graph_git_two_modes() helper added in 177722b3442 (commit: integrate commit graph with commit parsing, 2018-04-10) didn't &&-chain its "git commit-graph" invocations, which as can be seen with SANITIZE=leak will happily mark tests as passing if both of these commands die, since test_cmp() will be comparing two empty files. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5318-commit-graph.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh index 295c5bd94d2..88fbe004a38 100755 --- a/t/t5318-commit-graph.sh +++ b/t/t5318-commit-graph.sh @@ -70,8 +70,8 @@ test_expect_success 'create commits and repack' ' ' graph_git_two_modes() { - git -c core.commitGraph=true $1 >output - git -c core.commitGraph=false $1 >expect + git -c core.commitGraph=true $1 >output && + git -c core.commitGraph=false $1 >expect && test_cmp expect output } From patchwork Thu Oct 14 23:37:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12559609 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36760C433FE for ; Thu, 14 Oct 2021 23:37:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AADD60C4B for ; Thu, 14 Oct 2021 23:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234442AbhJNXj3 (ORCPT ); Thu, 14 Oct 2021 19:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234410AbhJNXj0 (ORCPT ); Thu, 14 Oct 2021 19:39:26 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3730C061753 for ; Thu, 14 Oct 2021 16:37:20 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id k7so23016324wrd.13 for ; Thu, 14 Oct 2021 16:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kXmkAGzaxfYRFaeHg7jduXjEuORrryzMVt+gSAozDo0=; b=G6a1k2cK51TboduwNgMRk2erOjwW6tHyhzIWxVJyO7CZPHY4VY/J5TaA4oyL0QbWhB JVQfR1kC2ohawxfQ2cTtxqlLcdp3T8uN0ciW79psrO6sP/F9LMIkD3xJ8iTqWszYhtDj NLj7Sxexffrt99CY9mKil4z72NB/bupNUGa3zOZk93tEDRvwK0C6P6NfD9NJmIuObCk5 CFawoq6O9JOScHmRIr63qqZvhgcIkyfSaOxHHD5Ht5hUmC37xFfp11jfK9i1YfRlgsPL zw3yej6UDo8j06JFRQROmMeIvMoNNQdYa1p5zLWMctTSMEE58ho6L0SD7XVNQLdu6FUV hr7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kXmkAGzaxfYRFaeHg7jduXjEuORrryzMVt+gSAozDo0=; b=Q1odcCMJ925Sa1+teq7IcDqxvWoBpDPgKVBi+frZ1v+kXvbE9u3YnYL039NvW70M9B yFTFn0E6sfkuHA4amCiM8eSEmF3DANeE4SQN+EWuZwunrLUrOPq5vK5a8V+0xrWzyu/G QvUxr2oGhub4Ketdgbk1b1RLzhwlaj499R0TigqH3FYG807gQq69uFkA0UD7HZI+4tMb kr0T3W1oKaH3PxU9FBv8hYEk3AlghF1srHPQJIvopIvlVPTuLrvj7xR1utsENBK1WCe5 Ra3QggvzL40Jy90JJ46wDwvYwVQhKBtNT93c5bRyVjaGUbMQtkiteBQReXxXwDZ6oSPI /O7w== X-Gm-Message-State: AOAM533ci4J5PgSvvkMtXrU8ADwROJQhDjqcXKGAzSseGEU06nJ26qjo 0olHqMQLyABWuZDaqyWDBG8D5pgy92bkmg== X-Google-Smtp-Source: ABdhPJzcG0inY5DTKo3OJKh7RG3FWf7rtUPS7RVR9V73fV8HJnmuSq0GViA4PwUDuNCwv+6MVhGQmA== X-Received: by 2002:adf:9b8a:: with SMTP id d10mr9759100wrc.151.1634254639163; Thu, 14 Oct 2021 16:37:19 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id g16sm3547658wrs.90.2021.10.14.16.37.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 16:37:18 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= Subject: [PATCH 2/3] commit-graph tests: fix another graph_git_two_modes() helper Date: Fri, 15 Oct 2021 01:37:15 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1338.g20da966911a In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In 135a7123755 (commit-graph: add --split option to builtin, 2019-06-18) this function was copy/pasted to the split commit-graph tests, as in the preceding commit we need to fix this to use &&-chaining, so it won't be hiding errors. Unlike its sister function in "t5318-commit-graph.sh", which we got lucky with, this one was hiding a real test failure. A tests added in c523035cbd8 (commit-graph: allow cross-alternate chains, 2019-06-18) has never worked as intended. Unlike most other graph_git_behavior uses in this file it clones the repository into a sub-directory, so we'll need to refer to "commits/6" as "origin/commits/6". It's not easy to simply move the "graph_git_behavior" to the test above it, since it itself spawns a "test_expect_success". Let's instead add support to "graph_git_behavior()" and "graph_git_two_modes()" to pass a "-C" argument to git. We also need to add a "test -d fork" here, because otherwise we'll fail on e.g.: GIT_SKIP_TESTS=t5324.13 ./t5324-split-commit-graph.sh Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5324-split-commit-graph.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh index 587226ed103..847b8097109 100755 --- a/t/t5324-split-commit-graph.sh +++ b/t/t5324-split-commit-graph.sh @@ -55,8 +55,8 @@ test_expect_success 'create commits and write commit-graph' ' ' graph_git_two_modes() { - git -c core.commitGraph=true $1 >output - git -c core.commitGraph=false $1 >expect + git ${2:+ -C "$2"} -c core.commitGraph=true $1 >output && + git ${2:+ -C "$2"} -c core.commitGraph=false $1 >expect && test_cmp expect output } @@ -64,12 +64,13 @@ graph_git_behavior() { MSG=$1 BRANCH=$2 COMPARE=$3 + DIR=$4 test_expect_success "check normal git operations: $MSG" ' - graph_git_two_modes "log --oneline $BRANCH" && - graph_git_two_modes "log --topo-order $BRANCH" && - graph_git_two_modes "log --graph $COMPARE..$BRANCH" && - graph_git_two_modes "branch -vv" && - graph_git_two_modes "merge-base -a $BRANCH $COMPARE" + graph_git_two_modes "log --oneline $BRANCH" "$DIR" && + graph_git_two_modes "log --topo-order $BRANCH" "$DIR" && + graph_git_two_modes "log --graph $COMPARE..$BRANCH" "$DIR" && + graph_git_two_modes "branch -vv" "$DIR" && + graph_git_two_modes "merge-base -a $BRANCH $COMPARE" "$DIR" ' } @@ -187,7 +188,10 @@ test_expect_success 'create fork and chain across alternate' ' ) ' -graph_git_behavior 'alternate: commit 13 vs 6' commits/13 commits/6 +if test -d fork +then + graph_git_behavior 'alternate: commit 13 vs 6' commits/13 origin/commits/6 "fork" +fi test_expect_success 'test merge stragety constants' ' git clone . merge-2 && From patchwork Thu Oct 14 23:37:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12559611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FB1BC433F5 for ; Thu, 14 Oct 2021 23:37:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A9F461152 for ; Thu, 14 Oct 2021 23:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234447AbhJNXja (ORCPT ); Thu, 14 Oct 2021 19:39:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234435AbhJNXj0 (ORCPT ); Thu, 14 Oct 2021 19:39:26 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 613B1C061570 for ; Thu, 14 Oct 2021 16:37:21 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id o20so23227046wro.3 for ; Thu, 14 Oct 2021 16:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qhq6D6AGMSMJVpPSOAYmx/RXfAVyPuuxNwMaVszI/7A=; b=G9yDCusqe/KVPXAbYO6lyl1AT6rYLpfUQQP+t+mi8wXhzdJYF0w9ZEdSUDEZLC0Z+e HDsL7G2g6rSnKUKFSbOdYuYfyRYvJ7lWdumtjr31I9rZItruxmyTgguMEzr+ab/iAzuY WLq2nRsoORPH6GvwF+YJuP/5IhdsJWnXBp+XqhNVjUcrzM/0JU5HXy473myVEJl6LDKG G3arWv98Uqvgz/uskTzxvTUgTkMhNUav+8vEphNv/PdgOQDLQS2FHaYBn+OBYhBrbBHs w5ALbtFpQ6VvRLVrBMkX9Dch8mfqA6o0V6xg+RrlWn2jNNVQSzPSdeu8iXtfbhSVR62A faZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qhq6D6AGMSMJVpPSOAYmx/RXfAVyPuuxNwMaVszI/7A=; b=GwaYHTw+siSlljEXwILwgE8XXzOpW7DidWvaqFiwTYs3QxdYotaO9TomxjIS2hIMGJ hPajB0+cvz0PHlA9c5SGJOyZ3SaZ4+5aUJKzRuwiaZJ+WqrU2VElsNqNFvck2GcbC4Ln icgtAZhDeF9dd10xDofT5gOSJUWTdtPk5XQJMqeCSW5q8ShCnEUfZ+JRCtwRrTapWuaS Qz1AGDjm4Beh+KzmvlpmiKdfAkKM19XoKu558brGaCr8jWjJQLXw6JFjD+hAsCox2g37 uA9e9Zf3DoYXyGWsQg0MH3YPo6xmYy4R4VLYkDFBf5oQKFsNcQgaetMDBmJVvj5bmE3k RDoA== X-Gm-Message-State: AOAM533Yrw/7MKkhuP/X1HL6IkuF0ZK5nKZEw14NffcFTOjRSEFpDgCR sduZXthD0bo/iENRPHn8C1Knsj7hAqtaXg== X-Google-Smtp-Source: ABdhPJzmIn+L8QHLhPJuQO14OUKOglwUJhv7FH8Jb8cDc3DsrzAp5Wl57vCVowDABvraKqYxXNNNIg== X-Received: by 2002:adf:f10a:: with SMTP id r10mr10476079wro.102.1634254639820; Thu, 14 Oct 2021 16:37:19 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id g16sm3547658wrs.90.2021.10.14.16.37.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 16:37:19 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= Subject: [PATCH 3/3] commit-graph: don't consider "replace" objects with "verify" Date: Fri, 15 Oct 2021 01:37:16 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1338.g20da966911a In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Extend the code added in d6538246d3d (commit-graph: not compatible with replace objects, 2018-08-20) which ignored replace objects in the "write" command to ignore it in the "verify" command too. We can just move this assignment to the cmd_commit_graph(), it dispatches to "write" and "verify", and we're unlikely to ever get a sub-command that would like to consider replace refs. This will make tests added in eddc1f556cd (mktag tests: test update-ref and reachable fsck, 2021-06-17) pass in combination with the "GIT_TEST_COMMIT_GRAPH" mode added in 859fdc0c3cf (commit-graph: define GIT_TEST_COMMIT_GRAPH, 2018-08-29), except that mode is currently broken (but is being fixed concurrently). See the discussion starting at [1]. 1. https://lore.kernel.org/git/87wnmihswp.fsf@evledraar.gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/commit-graph.c | 2 +- t/t5318-commit-graph.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index 3c3de3a156f..fb8e166a26f 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -263,7 +263,6 @@ static int graph_write(int argc, const char **argv) git_env_bool(GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS, 0)) flags |= COMMIT_GRAPH_WRITE_BLOOM_FILTERS; - read_replace_refs = 0; odb = find_odb(the_repository, opts.obj_dir); if (opts.reachable) { @@ -318,6 +317,7 @@ int cmd_commit_graph(int argc, const char **argv, const char *prefix) if (!argc) goto usage; + read_replace_refs = 0; save_commit_buffer = 0; if (!strcmp(argv[0], "verify")) diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh index 88fbe004a38..84d122a7ae7 100755 --- a/t/t5318-commit-graph.sh +++ b/t/t5318-commit-graph.sh @@ -385,6 +385,7 @@ test_expect_success 'replace-objects invalidates commit-graph' ' git commit-graph write --reachable && test_path_is_file .git/objects/info/commit-graph && git replace HEAD~1 HEAD~2 && + graph_git_two_modes "commit-graph verify" && git -c core.commitGraph=false log >expect && git -c core.commitGraph=true log >actual && test_cmp expect actual &&