From patchwork Sat Jan 23 13:00:37 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: 12041533 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 F3BFCC433DB for ; Sat, 23 Jan 2021 13:02:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B977522CB9 for ; Sat, 23 Jan 2021 13:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725769AbhAWNB5 (ORCPT ); Sat, 23 Jan 2021 08:01:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725290AbhAWNBr (ORCPT ); Sat, 23 Jan 2021 08:01:47 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CE04C0613D6 for ; Sat, 23 Jan 2021 05:01:06 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id m187so6578838wme.2 for ; Sat, 23 Jan 2021 05:01:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A7FoRZuMMIbetJTNalFcrGgbffGakIFy89xOqs/udAQ=; b=EOQs9GRGxqqRCH2y8+fPD8YPjYJTj1pNzU8h4JJ9lsssnG37xcwD/yL+dt6xdSFOEz bsc7kbaUEI3rDeq7qVfGzKLbZs2M61MOXrLHd9oKhCuFWaTA2QHEcTbmDXjVRF6npBml aTPFfM38KrM70Cqlsx9ZhY3j+hSc4p7bR2j1spKTIFN2WvkiKSrm9K5lBouLkETdr2zl D/5As3+Uz4X7/H9M6ruCoEpqlNVwPptvATArBCG2S6GVnKbd/spPHw4azOxk4YVlzFTE 8eSBJcKFLn4AbLdRDOlGYLlOkf0cDECplt1oCjZidtKTBKwDKtyc3DQw60kk8OutbUAS PTNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A7FoRZuMMIbetJTNalFcrGgbffGakIFy89xOqs/udAQ=; b=bCTFdjXlx2z0InOL5v18c/UGurWkAnLllkhDVGTje9asLhAS0ZiojfuqTGYE3GLKae mFQnVIA45Jr2O7OX97BqAwWJZG5NQgaBHCptZz7Tr6rPrwO7pRxFthXkjVvX8rCyir5V Da+eRbwLZX+AzWlUjLt+0+1QIfXbeyO5mtnZQiEuR4WAGM3DkBNXgR7yIAl0+3f7F/vZ ym1aZ78436VLdoq+JhzVAswXPIgBEmXBLZ8yhxfPqaN8Jbp+jAnxM5dTDiVLdQ8cnLyg sPiFBPj0OFnlvPZpxS7FOZwIEOQGYAyAWkemmpffy/B4fB1IK//dWTLUhXn3W4msuGze iygQ== X-Gm-Message-State: AOAM5307vupjG4QII69n5cmzZFCyl3wy9MkkMdpC6ZLgK7iWhTqAIwYN bMnqOGo400vebnEdeyzDonCXnRdE387rqA== X-Google-Smtp-Source: ABdhPJwqDMJ4M77NX5fyRJJywSJji9pZXiJhrsmMB/1bKRJa8+uIlfkkMAbz/5WmYKL2Iu1EqXKKTw== X-Received: by 2002:a1c:dc83:: with SMTP id t125mr8215487wmg.154.1611406864849; Sat, 23 Jan 2021 05:01:04 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c7sm16750319wro.16.2021.01.23.05.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 05:01:04 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Denton Liu , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 01/10] cache-tree tests: refactor for modern test style Date: Sat, 23 Jan 2021 14:00:37 +0100 Message-Id: <20210123130046.21975-2-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <87sg6s6lrs.fsf@evledraar.gmail.com> References: <87sg6s6lrs.fsf@evledraar.gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Refactor the cache-tree test file to use our current recommended patterns. This makes a subsequent meaningful change easier to read. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t0090-cache-tree.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh index 5a633690bf..45e1cc82ed 100755 --- a/t/t0090-cache-tree.sh +++ b/t/t0090-cache-tree.sh @@ -10,7 +10,8 @@ cache-tree extension. cmp_cache_tree () { test-tool dump-cache-tree | sed -e '/#(ref)/d' >actual && sed "s/$OID_REGEX/SHA/" filtered && - test_cmp "$1" filtered + test_cmp "$1" filtered && + rm filtered } # We don't bother with actually checking the SHA1: @@ -54,7 +55,7 @@ test_invalid_cache_tree () { } test_no_cache_tree () { - : >expect && + >expect && cmp_cache_tree expect } @@ -83,18 +84,6 @@ test_expect_success 'git-add in subdir invalidates cache-tree' ' test_invalid_cache_tree ' -cat >before <<\EOF -SHA (3 entries, 2 subtrees) -SHA dir1/ (1 entries, 0 subtrees) -SHA dir2/ (1 entries, 0 subtrees) -EOF - -cat >expect <<\EOF -invalid (2 subtrees) -invalid dir1/ (0 subtrees) -SHA dir2/ (1 entries, 0 subtrees) -EOF - test_expect_success 'git-add in subdir does not invalidate sibling cache-tree' ' git tag no-children && test_when_finished "git reset --hard no-children; git read-tree HEAD" && @@ -102,9 +91,20 @@ test_expect_success 'git-add in subdir does not invalidate sibling cache-tree' ' test_commit dir1/a && test_commit dir2/b && echo "I changed this file" >dir1/a && + test_when_finished "rm before" && + cat >before <<-\EOF && + SHA (3 entries, 2 subtrees) + SHA dir1/ (1 entries, 0 subtrees) + SHA dir2/ (1 entries, 0 subtrees) + EOF cmp_cache_tree before && echo "I changed this file" >dir1/a && git add dir1/a && + cat >expect <<-\EOF && + invalid (2 subtrees) + invalid dir1/ (0 subtrees) + SHA dir2/ (1 entries, 0 subtrees) + EOF cmp_cache_tree expect ' From patchwork Sat Jan 23 13:00:38 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: 12041537 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 1BFAAC433E6 for ; Sat, 23 Jan 2021 13:02:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DACBD22D01 for ; Sat, 23 Jan 2021 13:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725778AbhAWNB7 (ORCPT ); Sat, 23 Jan 2021 08:01:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725294AbhAWNBr (ORCPT ); Sat, 23 Jan 2021 08:01:47 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 686F9C061786 for ; Sat, 23 Jan 2021 05:01:07 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id c127so6703090wmf.5 for ; Sat, 23 Jan 2021 05:01:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cGf5sS5nnzZQN8HV8K7brEHNmd6buqHIlJBcMDeFDP0=; b=ecO3/4/Mx1TjMnNmxF6foTBjE2V60dywjPXtvDhSxAMXi32PjeF6djxBlNGHbAkrcq THifqrxXc7xFMUW7i+qDaXsERbRmZKAEWOytOKcLCokFlsZk/KQLrxrrC8VXTeeFC9G3 fjHz5KXebjoR0PGYgrGNT4o17EuxLJzVaglC/FhTuvuoEQAxNhmx8yI7ZxvUwebFruaa FxsKwjF5IRMQbFl0yPKtOaC5XMHZWcbmaiLPbhMrjlcubJLPguBzzikHiGHnSfIVjtL6 QJJDWJaZckz0VTzICFz7o3FdNJCLKVQ3msaUxrzhhzXmcum4ZiYrG0kGOOySknt3uomj LY6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cGf5sS5nnzZQN8HV8K7brEHNmd6buqHIlJBcMDeFDP0=; b=DVKCNd7p+4JueOAbruRAxiVhMznraUlL8Mll7YRr2Fz5Gwds+rRzKUZig5pewd8Sf2 ki4/g+3RSSVykU/YIypOiQ6bXz6xyE3AUR9hiMFCOjy/3Yxti/vAAhPpDikSgJ5QsnUH AL89G8cCQcWQEz6/5pDHzvaHt7oaL7e1UglXgCwKxHFIqQxDQ46g86PcaXld7p/m48Fc Asq9XBFnyEebdr2in2I8W0oF1QOPpWncEOGBNt/tJNmHQGl+MRkWVdj8iKkMDtMsDijW Qxi8qBH7Y7sUNrFbL9OOmtzGck7QYZzOxqunw1dh4fFDsqxKnUeEFRFPK/4ndx8IsUjw H4aw== X-Gm-Message-State: AOAM532O3mNbxOuWHcABlVhT0RUMV5jOZMBa1W+euHDOgrkLez2hiCU6 a35dmOZ7HrWB8fJLkBEehETuymnJ95wkvA== X-Google-Smtp-Source: ABdhPJzkKaH7irX6SXCnJ5nE3oMSe9nkvmAna1cavJp6bo85f/+JGTRgq/DLShFllypgU2HK9XoAUA== X-Received: by 2002:a1c:9692:: with SMTP id y140mr57104wmd.128.1611406865933; Sat, 23 Jan 2021 05:01:05 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c7sm16750319wro.16.2021.01.23.05.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 05:01:05 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Denton Liu , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 02/10] cache-tree tests: remove unused $2 parameter Date: Sat, 23 Jan 2021 14:00:38 +0100 Message-Id: <20210123130046.21975-3-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <87sg6s6lrs.fsf@evledraar.gmail.com> References: <87sg6s6lrs.fsf@evledraar.gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove the $2 paramater. This appears to have been some work-in-progress code from an earlier version of 9c4d6c0297 (cache-tree: Write updated cache-tree after commit, 2014-07-13) which was left in the final version. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t0090-cache-tree.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh index 45e1cc82ed..7ff7f04719 100755 --- a/t/t0090-cache-tree.sh +++ b/t/t0090-cache-tree.sh @@ -19,7 +19,6 @@ cmp_cache_tree () { # correct. generate_expected_cache_tree_rec () { dir="$1${1:+/}" && - parent="$2" && # ls-files might have foo/bar, foo/bar/baz, and foo/bar/quux # We want to count only foo because it's the only direct child git ls-files >files && @@ -30,10 +29,9 @@ generate_expected_cache_tree_rec () { for subtree in $subtrees do cd "$subtree" - generate_expected_cache_tree_rec "$dir$subtree" "$dir" || return 1 + generate_expected_cache_tree_rec "$dir$subtree" || return 1 cd .. - done && - dir=$parent + done } generate_expected_cache_tree () { From patchwork Sat Jan 23 13:00:39 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: 12041539 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 B8FB0C433DB for ; Sat, 23 Jan 2021 13:02:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CF1522CAF for ; Sat, 23 Jan 2021 13:02:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725819AbhAWNCB (ORCPT ); Sat, 23 Jan 2021 08:02:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725440AbhAWNBs (ORCPT ); Sat, 23 Jan 2021 08:01:48 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FDEEC061788 for ; Sat, 23 Jan 2021 05:01:08 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id j18so6590746wmi.3 for ; Sat, 23 Jan 2021 05:01:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Yic/Yy6hNB5o7SqughnfPB86/3RjIAx5Qe3c2I6N3SQ=; b=TUTx7a6W0pn6bI4nLJ4GN9/A1xZo7cayNVQFhS9sEXpih7TDHvE5K4vZo/zd7DhDMq xOokIDo72NQ/p6217V8NvKlvvTuxB6Y2xcQ3ieXRey0gpS+6fl/G5+F9Ijz7nMJkCbMR o8vlKLcljRKpmWTRHkrqzZ3j0rNOnQVHTLz2MWVlP1wEUS/C8QtMAocH5oQ7hDRFHtFi jkoQOUUI+v7m497GbAMQYrt1k2AQJxti6gzc4gXYau1RhzxDTXwLcUP3iBOrmo7WUQNG 0T9bVk6QaNWBbLeirNfZYGAQIv17bc/pqfe4EQYtDmnfDiVlHQzzFXLt+Rg05DG4G/SF kU2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Yic/Yy6hNB5o7SqughnfPB86/3RjIAx5Qe3c2I6N3SQ=; b=kRnqpD74VmfDlxC+tlEN7QMbPrTZwjSjqVdQ+pKnTsGI4OVb7UGY3GA8K/DvQb0eR4 dsbbpYTlu2bC245WOMxnLPA6y8GhocDvibkf6QLtG8mSKl9bDSI8wBUjJ6tK8xlnS0RV XX1PyiFaLzK8ajmYeGwMKr0ZAluCLxvDb+6KAzhXvGgsJKJhQAq+Kc5qntBMJ89QmAcN GP7Pgj8tioaqvVzanGBwk18/Xwx9j8TbQD7JZzQ63/EU+ZgtKrp03jszT5H+3mW4XTbq 9C3wV8kUzQ3NcZN9OLL3DfHr+Fx1BH3+VwMQPG76WPEUzKRm7Axe8MwTdrzOkyz/s7PC kkSQ== X-Gm-Message-State: AOAM530BJYC/QHiVw3rd6MI4idtAXfUf0mSIA4VCsFVrR5ZJCViv5yeh ScdTpHM6KeGSFAPhPpkR4bX3VLgHZBrVgQ== X-Google-Smtp-Source: ABdhPJz1I1BM8e0vlbtIUxoKdO0ybUrxly65kPsP0iULKAz0xrBH9NtrGB0lzjRPTBIg1UrWJvH2Ag== X-Received: by 2002:a7b:c055:: with SMTP id u21mr8391932wmc.68.1611406866829; Sat, 23 Jan 2021 05:01:06 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c7sm16750319wro.16.2021.01.23.05.01.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 05:01:06 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Denton Liu , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 03/10] cache-tree tests: use a sub-shell with less indirection Date: Sat, 23 Jan 2021 14:00:39 +0100 Message-Id: <20210123130046.21975-4-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <87sg6s6lrs.fsf@evledraar.gmail.com> References: <87sg6s6lrs.fsf@evledraar.gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change a "cd xyz && work && cd .." pattern introduced in 9c4d6c0297 (cache-tree: Write updated cache-tree after commit, 2014-07-13) to use a sub-shell instead with less indirection. We did actually recover correctly if we failed in this function since we were wrapped in a subshell one function call up. Let's just use the sub-shell at the point where we want to change the directory instead. It's important that the "|| return 1" is outside the subshell. Normally, we `exit 1` from within subshells[1], but that wouldn't help us exit this loop early[1][2]. Since we can get rid of the wrapper function let's rename the main function to drop the "rec" (for "recursion") suffix[3]. 1. https://lore.kernel.org/git/CAPig+cToj8nQmyBCqC1k7DXF2vXaonCEA-fCJ4x7JBZG2ixYBw@mail.gmail.com/ 2. https://lore.kernel.org/git/20150325052952.GE31924@peff.net/ 3. https://lore.kernel.org/git/YARsCsgXuiXr4uFX@coredump.intra.peff.net/ Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t0090-cache-tree.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh index 7ff7f04719..5bb4f75443 100755 --- a/t/t0090-cache-tree.sh +++ b/t/t0090-cache-tree.sh @@ -17,7 +17,7 @@ cmp_cache_tree () { # We don't bother with actually checking the SHA1: # test-tool dump-cache-tree already verifies that all existing data is # correct. -generate_expected_cache_tree_rec () { +generate_expected_cache_tree () { dir="$1${1:+/}" && # ls-files might have foo/bar, foo/bar/baz, and foo/bar/quux # We want to count only foo because it's the only direct child @@ -28,18 +28,13 @@ generate_expected_cache_tree_rec () { printf "SHA $dir (%d entries, %d subtrees)\n" "$entries" "$subtree_count" && for subtree in $subtrees do - cd "$subtree" - generate_expected_cache_tree_rec "$dir$subtree" || return 1 - cd .. + ( + cd "$subtree" && + generate_expected_cache_tree "$dir$subtree" + ) || return 1 done } -generate_expected_cache_tree () { - ( - generate_expected_cache_tree_rec - ) -} - test_cache_tree () { generate_expected_cache_tree >expect && cmp_cache_tree expect From patchwork Sat Jan 23 13:00:40 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: 12041541 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 CFF8FC433E0 for ; Sat, 23 Jan 2021 13:02:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A485B22CB2 for ; Sat, 23 Jan 2021 13:02:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725827AbhAWNCP (ORCPT ); Sat, 23 Jan 2021 08:02:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725550AbhAWNBt (ORCPT ); Sat, 23 Jan 2021 08:01:49 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D92DC06178B for ; Sat, 23 Jan 2021 05:01:09 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id c128so6707356wme.2 for ; Sat, 23 Jan 2021 05:01:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e4MVJFIcALWXtiqCpyDRveI5lqGSqtMFfVJBcMH/RDM=; b=HuYcfzSADOtfu2cLByvcw6Y0bSJZLoQpM8sOFnR0ac1E6uIbIdazth9CvV+74v4UCR s4S4G053Z2ReTquT3p4IJsmPssPN5Gw8Xh6yxymdg15jflrYMkBRmZjiLzVQDy8py2RB sI6LCMIowTIW6CAGKbfOYuFDRuyQneAXVXq3vtH8EIo7jS6OzUDOYZdLVYL+jCpu+KPL BsBsanOIv1auGsVWRXZwqENRPNHglYUos9n1l/ah/5p8qSpuqakjaWYBAQ98FYQyblSa jEJuMAjyoFvb1jtU/ROa5ODJbF49SwUJSUifuvUMCDb78kx2mWMofx74ZdPjCWwxVF2p /5tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e4MVJFIcALWXtiqCpyDRveI5lqGSqtMFfVJBcMH/RDM=; b=Son20PrRoyOHOnJiURRtYMRZggfBO8tkR1S/41bxFhs3RNV60irRfP5+DyR68e9vTP O9BAzpFhFJdfZHKPMI2NFbhHyE3CGX8jKXBIBAejzQfuykeLE5pnE33Hz93ej3dncw8o eM2dMW7DChymgWhnHgrbunnRl+KqDGyqbkcwZPQ88shFNUvN+WRZI2k/QLqvwNdzWFZa ZtQUyGGXQJF4L8kYdFG12wWXDpPwGplw646sPjvsLI5c3X+NhWvgOXbnnJBXd3wk4hpx H9FxVc4rqFbPWLBo2z+eUelHnN8m8D5DqHewVhVxbmL9BB5+V2xcUQfuHaeVcfOgjhYp X2Xw== X-Gm-Message-State: AOAM530/IUh5yqdCFoihqpRR64xA0tPhs0LrM4LRnjuOYoY6MKHOOGfx MXDl/+J04JA+pdk76pgP3i2nU/ROjdy+1Q== X-Google-Smtp-Source: ABdhPJwKI6tbdlkynX4tP98qoBsm5OF1YVqKHvEbHZ08tCWPT1yaFersKOkDC6zUep1+A+l5SmoPaQ== X-Received: by 2002:a1c:ddc6:: with SMTP id u189mr8355800wmg.172.1611406867702; Sat, 23 Jan 2021 05:01:07 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c7sm16750319wro.16.2021.01.23.05.01.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 05:01:07 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Denton Liu , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 04/10] cache-tree tests: explicitly test HEAD and index differences Date: Sat, 23 Jan 2021 14:00:40 +0100 Message-Id: <20210123130046.21975-5-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <87sg6s6lrs.fsf@evledraar.gmail.com> References: <87sg6s6lrs.fsf@evledraar.gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test code added in 9c4d6c0297 (cache-tree: Write updated cache-tree after commit, 2014-07-13) used "ls-files" in lieu of "ls-tree" because it wanted to test the data in the index, since this test is testing the cache-tree extension. Change the test to instead use "ls-tree" for traversal, and then explicitly check how HEAD differs from the index. This is more easily understood, and less fragile as numerous past bug fixes[1][2][3] to the old code we're replacing demonstrate. As an aside this would be a bit easier if empty pathspecs hadn't been made an error in d426430e6e (pathspec: warn on empty strings as pathspec, 2016-06-22) and 9e4e8a64c2 (pathspec: die on empty strings as pathspec, 2017-06-06). If that was still allowed this code could be simplified slightly: diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh index 9bf66c9e68..0b02881f55 100755 --- a/t/t0090-cache-tree.sh +++ b/t/t0090-cache-tree.sh @@ -18,19 +18,18 @@ cmp_cache_tree () { # test-tool dump-cache-tree already verifies that all existing data is # correct. generate_expected_cache_tree () { - pathspec="$1" && - dir="$2${2:+/}" && + pathspec="$1${1:+/}" && git ls-tree --name-only HEAD -- "$pathspec" >files && git ls-tree --name-only -d HEAD -- "$pathspec" >subtrees && - printf "SHA %s (%d entries, %d subtrees)\n" "$dir" $(wc -l expect && + generate_expected_cache_tree >expect && cmp_cache_tree expect && rm expect actual files subtrees && git status --porcelain -- ':!status' ':!expected.status' >status && 1. c8db708d5d (t0090: avoid passing empty string to printf %d, 2014-09-30) 2. d69360c6b1 (t0090: tweak awk statement for Solaris /usr/xpg4/bin/awk, 2014-12-22) 3. 9b5a9fa60a (t0090: stop losing return codes of git commands, 2019-11-27) Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t0090-cache-tree.sh | 45 ++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh index 5bb4f75443..9bf66c9e68 100755 --- a/t/t0090-cache-tree.sh +++ b/t/t0090-cache-tree.sh @@ -18,26 +18,28 @@ cmp_cache_tree () { # test-tool dump-cache-tree already verifies that all existing data is # correct. generate_expected_cache_tree () { - dir="$1${1:+/}" && - # ls-files might have foo/bar, foo/bar/baz, and foo/bar/quux - # We want to count only foo because it's the only direct child - git ls-files >files && - subtrees=$(grep / files|cut -d / -f 1|uniq) && - subtree_count=$(echo "$subtrees"|awk -v c=0 '$1 != "" {++c} END {print c}') && - entries=$(wc -l files && + git ls-tree --name-only -d HEAD -- "$pathspec" >subtrees && + printf "SHA %s (%d entries, %d subtrees)\n" "$dir" $(wc -l expect && - cmp_cache_tree expect + generate_expected_cache_tree "." >expect && + cmp_cache_tree expect && + rm expect actual files subtrees && + git status --porcelain -- ':!status' ':!expected.status' >status && + if test -n "$1" + then + test_cmp "$1" status + else + test_must_be_empty status + fi } test_invalid_cache_tree () { @@ -126,6 +128,7 @@ test_expect_success 'second commit has cache-tree' ' ' test_expect_success PERL 'commit --interactive gives cache-tree on partial commit' ' + test_when_finished "git reset --hard" && cat <<-\EOT >foo.c && int foo() { @@ -152,7 +155,10 @@ test_expect_success PERL 'commit --interactive gives cache-tree on partial commi EOT test_write_lines p 1 "" s n y q | git commit --interactive -m foo && - test_cache_tree + cat <<-\EOF >expected.status && + M foo.c + EOF + test_cache_tree expected.status ' test_expect_success PERL 'commit -p with shrinking cache-tree' ' @@ -243,7 +249,10 @@ test_expect_success 'partial commit gives cache-tree' ' git add one.t && echo "some other change" >two.t && git commit two.t -m partial && - test_cache_tree + cat <<-\EOF >expected.status && + M one.t + EOF + test_cache_tree expected.status ' test_expect_success 'no phantom error when switching trees' ' From patchwork Sat Jan 23 13:00:41 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: 12041543 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 6B25FC433DB for ; Sat, 23 Jan 2021 13:02:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42D4722CAF for ; Sat, 23 Jan 2021 13:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725911AbhAWNCn (ORCPT ); Sat, 23 Jan 2021 08:02:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725864AbhAWNC3 (ORCPT ); Sat, 23 Jan 2021 08:02:29 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A572C061793 for ; Sat, 23 Jan 2021 05:01:10 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id m2so6589413wmm.1 for ; Sat, 23 Jan 2021 05:01:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q4bQogwsI9bRYCSjZJ+4/WLU6cJS2PZu/ileYKDTFTk=; b=MH8Bt4sZ2mYrM1a3dVQ9aRceBrXz/jQgZbiiBxJFc5z28gVLSPO1wGmfrVfolEzDlx b/6lFXvdwNleU8hWfgoEWtzMfudroZk6/Pk5o5Ik5Tf6itwhX1k+WQxWJnsNHKoDiyoE rlhEcsZYrqrWaTu1UncPuohBcIWQ9DhMpCdDwx+4sXDml0sUCojusQlxqOmPY0qaqVTk AY7TP6pC36Vh6KJVkH+ur+2IOB4nWWEa1N+sZYF7jwdnWeog5s6RBwij8rSvojkdQatm 6NjFoqqA4kpJUZqjE/GGMnvJLXQR8bc/8OFcc0bq2uERbL3nW3RblqCaXeRXsXxPMIbl aXww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q4bQogwsI9bRYCSjZJ+4/WLU6cJS2PZu/ileYKDTFTk=; b=VamFKb/dwXUy+fhVwIjgNG87wZvnZwqfUZUtn7hqJwkiAhnDQLB6ORZkuzFrjVEXDY pnSNC4PsrGJAmpp/teQNqIZ9AQxLUoOrh9A6ACa3BefPimuzj9l/4v3quZCveAslpCNu RfHi6xfb4ViCsTupqE7/PjEilPw4Gki1+YT6q2m6JLkteQneX58CZ3Y61dNfVcwhp7Ah U+6vhrf+fgTQeWpteWQSKj2c4i3EyRCWFBSmd9FHn2jXx1oFJaL4vXbDjYyqcmcicRho cLhkWxK3VL2ypEkdLyieFRNnVg3G5Ctrfd0zbOSNHK7dv5PxtCzvY0laGao1uqTmrGzo vC1g== X-Gm-Message-State: AOAM5323XIVX/CW3om1t2H59K0hrGfa+5utiOa2+kpZFfvD9Oe+0Le4x A1EwQyJTG93kJ8RQc6fMoMZwXyUFwdlM1Q== X-Google-Smtp-Source: ABdhPJwY3PT3nEhxEgx5ivjyiZyWvKXREeIFsJlAiOO/TGsTzGX36rAeHtfatQ8Rzs/rWYkHbfpR7w== X-Received: by 2002:a7b:c355:: with SMTP id l21mr67868wmj.61.1611406868749; Sat, 23 Jan 2021 05:01:08 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c7sm16750319wro.16.2021.01.23.05.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 05:01:07 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Denton Liu , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 05/10] git svn mergeinfo tests: modernize redirection & quoting style Date: Sat, 23 Jan 2021 14:00:41 +0100 Message-Id: <20210123130046.21975-6-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <87sg6s6lrs.fsf@evledraar.gmail.com> References: <87sg6s6lrs.fsf@evledraar.gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Use " --- t/t9151-svn-mergeinfo.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/t/t9151-svn-mergeinfo.sh b/t/t9151-svn-mergeinfo.sh index 4f6c06ecb2..59c5847c5f 100755 --- a/t/t9151-svn-mergeinfo.sh +++ b/t/t9151-svn-mergeinfo.sh @@ -9,37 +9,37 @@ test_description='git-svn svn mergeinfo properties' test_expect_success 'load svn dump' " svnadmin load -q '$rawsvnrepo' \ - < '$TEST_DIRECTORY/t9151/svn-mergeinfo.dump' && + <'$TEST_DIRECTORY/t9151/svn-mergeinfo.dump' && git svn init --minimize-url -R svnmerge \ --rewrite-root=http://svn.example.org \ -T trunk -b branches '$svnrepo' && git svn fetch --all - " +" test_expect_success 'all svn merges became git merge commits' ' unmarked=$(git rev-list --parents --all --grep=Merge | grep -v " .* " | cut -f1 -d" ") && [ -z "$unmarked" ] - ' +' test_expect_success 'cherry picks did not become git merge commits' ' bad_cherries=$(git rev-list --parents --all --grep=Cherry | grep " .* " | cut -f1 -d" ") && [ -z "$bad_cherries" ] - ' +' test_expect_success 'svn non-merge merge commits did not become git merge commits' ' bad_non_merges=$(git rev-list --parents --all --grep=non-merge | grep " .* " | cut -f1 -d" ") && [ -z "$bad_non_merges" ] - ' +' test_expect_success 'commit made to merged branch is reachable from the merge' ' before_commit=$(git rev-list --all --grep="trunk commit before merging trunk to b2") && merge_commit=$(git rev-list --all --grep="Merge trunk to b2") && not_reachable=$(git rev-list -1 $before_commit --not $merge_commit) && [ -z "$not_reachable" ] - ' +' test_expect_success 'merging two branches in one commit is detected correctly' ' f1_commit=$(git rev-list --all --grep="make f1 branch from trunk") && @@ -47,11 +47,11 @@ test_expect_success 'merging two branches in one commit is detected correctly' ' merge_commit=$(git rev-list --all --grep="Merge f1 and f2 to trunk") && not_reachable=$(git rev-list -1 $f1_commit $f2_commit --not $merge_commit) && [ -z "$not_reachable" ] - ' +' test_expect_failure 'everything got merged in the end' ' unmerged=$(git rev-list --all --not master) && [ -z "$unmerged" ] - ' +' test_done From patchwork Sat Jan 23 13:00:42 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: 12041545 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 00DEAC433E0 for ; Sat, 23 Jan 2021 13:02:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CEE1C22CAF for ; Sat, 23 Jan 2021 13:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725854AbhAWNCp (ORCPT ); Sat, 23 Jan 2021 08:02:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725868AbhAWNC3 (ORCPT ); Sat, 23 Jan 2021 08:02:29 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24E0DC061794 for ; Sat, 23 Jan 2021 05:01:11 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id i63so6584954wma.4 for ; Sat, 23 Jan 2021 05:01:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ImXUkZ6o3CFBgFdea1OS0wH2Fcn8MK141oZMsNbmFjc=; b=OjKQz4eSSzEViFFMPJ5uvZNNt2SABGtrTnIREXB6K5vZc1+WuqNLrWklQD2LF9HK8m DJg60uxUmbCtLWS6md9rM8aDGTihjQNEKzR/oYYLOKq8/U4QfYXKVXoum0+qBdNOIIIb TagxLIUYRNYDP0pmQuGbTjoEePyvV4jijEWoosT4RJ1T9J4Xlj2nFj4qG7rvxOq5MXot 2fzCCVI+GdT4IJbJUKajkZqG0DliH+ulqUCgX6I2AVOxbBydTH1CsUk0nrin86OHzeAe S2+Jwvrxp2wBTu2HaalmvO2VazTaacRSxuePkpZovcxdHTiYG5LvqbEKJQLMoN7D27DF OSJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ImXUkZ6o3CFBgFdea1OS0wH2Fcn8MK141oZMsNbmFjc=; b=Ru6J2Jkq/GofQQSuaXWCHGV/du9KDVNbzjSE9zvzlNvnEZ1BhcI8ZcvWrwhSJ3ZcD2 idDppBBOAObzoELLkU0HY6wZbddroZjVP9RyKg/fd26xqxyK21HGOiPSbF16hiXeaiaD geqLnvuLE0zzuFgtQs+q4zcsoAs7EBK9GYi0uv8DDx63OG2UgyM4FrQdEnWYcEK2BlbX RsXdXbmn944mv/3LXtYR/uaPwaUTycXf2Q6ei+x9y9NqfSvOyyin/1uay1qsa2RkR8yb EzrUGBP3hdubebMidg4s0ixONtwacNBXDJlW8x2+/YUJ7G8YHUnDKxGBMaY1UbmyfnzH 9PFQ== X-Gm-Message-State: AOAM532uVrikCLF8cQ9LDFzdK/pxlvAb5k+NryWxkYKoiSdaypyM31iJ PI6e8vwiKowxQ8bNlQgJEVMZXADmPwTx6Q== X-Google-Smtp-Source: ABdhPJxjKradDoxAVE2pEQx6JTl5JN4GcskSKvolg1e6o3L1cyC3KSY4VhCdpUVOky5eDj5JJBiBpg== X-Received: by 2002:a7b:c246:: with SMTP id b6mr8322815wmj.118.1611406869633; Sat, 23 Jan 2021 05:01:09 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c7sm16750319wro.16.2021.01.23.05.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 05:01:08 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Denton Liu , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 06/10] git svn mergeinfo tests: refactor "test -z" to use test_must_be_empty Date: Sat, 23 Jan 2021 14:00:42 +0100 Message-Id: <20210123130046.21975-7-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <87sg6s6lrs.fsf@evledraar.gmail.com> References: <87sg6s6lrs.fsf@evledraar.gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Refactor some old-style test code to use test_must_be_empty instead of "test -z". This makes a follow-up commit easier to read. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t9151-svn-mergeinfo.sh | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/t/t9151-svn-mergeinfo.sh b/t/t9151-svn-mergeinfo.sh index 59c5847c5f..806eff4023 100755 --- a/t/t9151-svn-mergeinfo.sh +++ b/t/t9151-svn-mergeinfo.sh @@ -17,41 +17,42 @@ test_expect_success 'load svn dump' " " test_expect_success 'all svn merges became git merge commits' ' - unmarked=$(git rev-list --parents --all --grep=Merge | - grep -v " .* " | cut -f1 -d" ") && - [ -z "$unmarked" ] + git rev-list --parents --all --grep=Merge | + grep -v " .* " | cut -f1 -d" " >unmarked && + test_must_be_empty unmarked ' + test_expect_success 'cherry picks did not become git merge commits' ' - bad_cherries=$(git rev-list --parents --all --grep=Cherry | - grep " .* " | cut -f1 -d" ") && - [ -z "$bad_cherries" ] + git rev-list --parents --all --grep=Cherry | + grep " .* " | cut -f1 -d" " >bad-cherries && + test_must_be_empty bad-cherries ' test_expect_success 'svn non-merge merge commits did not become git merge commits' ' - bad_non_merges=$(git rev-list --parents --all --grep=non-merge | - grep " .* " | cut -f1 -d" ") && - [ -z "$bad_non_merges" ] + git rev-list --parents --all --grep=non-merge | + grep " .* " | cut -f1 -d" " >bad-non-merges && + test_must_be_empty bad-non-merges ' test_expect_success 'commit made to merged branch is reachable from the merge' ' before_commit=$(git rev-list --all --grep="trunk commit before merging trunk to b2") && merge_commit=$(git rev-list --all --grep="Merge trunk to b2") && - not_reachable=$(git rev-list -1 $before_commit --not $merge_commit) && - [ -z "$not_reachable" ] + git rev-list -1 $before_commit --not $merge_commit >not-reachable && + test_must_be_empty not-reachable ' test_expect_success 'merging two branches in one commit is detected correctly' ' f1_commit=$(git rev-list --all --grep="make f1 branch from trunk") && f2_commit=$(git rev-list --all --grep="make f2 branch from trunk") && merge_commit=$(git rev-list --all --grep="Merge f1 and f2 to trunk") && - not_reachable=$(git rev-list -1 $f1_commit $f2_commit --not $merge_commit) && - [ -z "$not_reachable" ] + git rev-list -1 $f1_commit $f2_commit --not $merge_commit >not-reachable && + test_must_be_empty not-reachable ' test_expect_failure 'everything got merged in the end' ' - unmerged=$(git rev-list --all --not master) && - [ -z "$unmerged" ] + git rev-list --all --not master >unmerged && + test_must_be_empty unmerged ' test_done From patchwork Sat Jan 23 13:00:43 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: 12041547 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 F2209C433DB for ; Sat, 23 Jan 2021 13:02:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C436E22CB2 for ; Sat, 23 Jan 2021 13:02:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725940AbhAWNCq (ORCPT ); Sat, 23 Jan 2021 08:02:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbhAWNC3 (ORCPT ); Sat, 23 Jan 2021 08:02:29 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C684C061797 for ; Sat, 23 Jan 2021 05:01:12 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id m2so6589477wmm.1 for ; Sat, 23 Jan 2021 05:01:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sNPWbhKvtoOtgrUNqPaCjBr5Y4X1dFhd0+qmgkc3PnY=; b=GPGCww5vmeq5t/kdTOZfbr0JNxTQiNSib7k0zdyHKstX7kHK4I5V0NQh33cEyCV0E0 V1DEB47QP2zX3jd/U7aCONXMwTnzasWl7/BMSXxITn5jDDiwZAhLhsJ54D2aiMgGnItT AARx452w2bLk0dkZ15FLMliawAasvIsu1dM6jCaKMBxujmizkNDIR9qAszvSRpHmen5V Snxb0Zqdp9wiRlP8cKSFdEDp2BWK7+yKmhxr+rzRSyGkjAS8P18FSQhvdBIAhEmEeQZJ tOIjRpwZnnxQt1tfMMMEdzol9CRB/fV3Nx/9fCY2k8jdEmrWLIOMw5cH/QmiGqDn70wT 8DXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sNPWbhKvtoOtgrUNqPaCjBr5Y4X1dFhd0+qmgkc3PnY=; b=KOlqg9ubqfgHeKssJhcn8svkkSQIOlQnb7S3E+cqHi5CVgFQ68F3H+gMWjvp2YGLcd VJmDent4kzfkrl13l23+y9RQyo7IQeCcSPp3flmHQZHeuIXejxbZLzB3EghVpdnal4nC OXpltqV7DTdRM98Yt/1OSml1MQnK2SniWUrJ+gupmSSoZubqjFwypHEBh7LocPUgALJ2 tGkmauvRdVZjHLeFQam9vBXZJKmKoIVsTnQqXMVXUcVDiFFTcGKEmFw9SHpLxWXJreP8 UO51Q9ytbAEEaEsjzcVK6iF72+tOTnf8rvqkBUwY+u3qCBGmC8Go1YhcLrZkQtK42jWE m+sQ== X-Gm-Message-State: AOAM533ZzaNCmBf865yNaxBh3eoQHw0xUlI0MEW9ayvgKZ1Kanuir+2q Q54OuqkdubhkFD3Edc86om2tF+GY3RLStQ== X-Google-Smtp-Source: ABdhPJw/UfqGQE4swH0H0ffhV55+L59NO1hZCd5JW5PcpShsXzeXxZ/cGvoI8H6cax93792qj/xNBw== X-Received: by 2002:a7b:cb4f:: with SMTP id v15mr8144493wmj.123.1611406870535; Sat, 23 Jan 2021 05:01:10 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c7sm16750319wro.16.2021.01.23.05.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 05:01:09 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Denton Liu , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 07/10] git-svn tests: rewrite brittle tests to use "--[no-]merges". Date: Sat, 23 Jan 2021 14:00:43 +0100 Message-Id: <20210123130046.21975-8-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <87sg6s6lrs.fsf@evledraar.gmail.com> References: <87sg6s6lrs.fsf@evledraar.gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jeff King Rewrite a brittle tests which used "rev-list" without "--[no-]merges" to figure out if a set of commits turned into merge commits or not. Signed-off-by: Jeff King [ÆAB: wrote commit message] Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t9151-svn-mergeinfo.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/t/t9151-svn-mergeinfo.sh b/t/t9151-svn-mergeinfo.sh index 806eff4023..c33bae91fb 100755 --- a/t/t9151-svn-mergeinfo.sh +++ b/t/t9151-svn-mergeinfo.sh @@ -17,21 +17,17 @@ test_expect_success 'load svn dump' " " test_expect_success 'all svn merges became git merge commits' ' - git rev-list --parents --all --grep=Merge | - grep -v " .* " | cut -f1 -d" " >unmarked && + git rev-list --all --no-merges --grep=Merge >unmarked && test_must_be_empty unmarked ' - test_expect_success 'cherry picks did not become git merge commits' ' - git rev-list --parents --all --grep=Cherry | - grep " .* " | cut -f1 -d" " >bad-cherries && + git rev-list --all --merges --grep=Cherry >bad-cherries && test_must_be_empty bad-cherries ' test_expect_success 'svn non-merge merge commits did not become git merge commits' ' - git rev-list --parents --all --grep=non-merge | - grep " .* " | cut -f1 -d" " >bad-non-merges && + git rev-list --all --merges --grep=non-merge >bad-non-merges && test_must_be_empty bad-non-merges ' From patchwork Sat Jan 23 13:00:44 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: 12041549 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 C43A1C433DB for ; Sat, 23 Jan 2021 13:02:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9950F22CB2 for ; Sat, 23 Jan 2021 13:02:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725946AbhAWNCt (ORCPT ); Sat, 23 Jan 2021 08:02:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725891AbhAWNCa (ORCPT ); Sat, 23 Jan 2021 08:02:30 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5A31C0617A7 for ; Sat, 23 Jan 2021 05:01:12 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id 190so6601152wmz.0 for ; Sat, 23 Jan 2021 05:01:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DeRamRegfWW2znduNnuo/vfYxA2obKx8NDdD3WMIqUo=; b=UoJ3gtw9uNgrDqS6X/w4zAQkHPFXkOzfnigmkpEeFXgxRvo74wpwlGs2H7QWtQsYwI 17+OsaL67xBlLdm0i6XKipI57QymW3oMITQV9BlJepcLxi9QxRYxnJ8h5aa3OEkPKYq3 N67iFHnGZRo5ZcM8oDmABZs5xRZnCrci13hVSqtd8yBnq1y5GkFCfeOVUWe1y9SJLDBn LN9iYcpIIrdqgBqDZhg88tFyPY5meJY5Q82rzhl8h9V5e4321y5UEtBEDeouZBN3yeK5 1ACo64JEt3WcpsewMB4DLT7/Eubh1Ui+sAp9iY/PWdTVXEoIbiHUazHLXLQoDiIvIh9P MIZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DeRamRegfWW2znduNnuo/vfYxA2obKx8NDdD3WMIqUo=; b=YICtd6NEmsjytkGqu3ciIJw25B8Z29vLPw4K/OMEXYBpZrl+Ua8pmj/HO9AMer8sas bDMO/OrkzXJ+ckuF6VRLjsPmj+1lmpZ+RFruD2piFpwBTait8qAEBhoLsZxlt522QGv4 GiQ3Uwe9m1IplXS6iaCsCz4468o7u+S1fA3FTizqOv8aNSmlJpIaZhv5ZQR7tB3+C3yN myvEvhDhlzz1/uixGFCESVuKfP/BGM2x0xxJjHTlKkPR6C6Zk8VOpQgINWxaycNarPHX aTtz4oAA2bBaDNeezMY8Qp7jIp96sT/cdTK36ik98Khwk649S/jz4pQTp9bGmP/jCwIt UFIQ== X-Gm-Message-State: AOAM533ghljmETr/3JqZWsqjDtOm9X9v1vD0n+jDX0bhD8doj8vTq5iJ 2HAZUTBUExpEYM85k3ZRIvtC4STbDIzK9w== X-Google-Smtp-Source: ABdhPJyhEUoTjp3QXfTd7dnPyyv2EVXpLZfamMymI54rCIJnxWh7jRvxktOu8cKHTG94uxpNtAtKZA== X-Received: by 2002:a1c:5941:: with SMTP id n62mr57065wmb.63.1611406871509; Sat, 23 Jan 2021 05:01:11 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c7sm16750319wro.16.2021.01.23.05.01.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 05:01:10 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Denton Liu , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 08/10] upload-pack tests: avoid a non-zero "grep" exit status Date: Sat, 23 Jan 2021 14:00:44 +0100 Message-Id: <20210123130046.21975-9-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <87sg6s6lrs.fsf@evledraar.gmail.com> References: <87sg6s6lrs.fsf@evledraar.gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Continue changing a test that 763b47bafa (t5703: stop losing return codes of git commands, 2019-11-27) already refactored. This was originally added as part of a series to add support for running under bash's "set -o pipefail", under that mode this test will fail because sometimes there's no commits in the "objs" output. It's easier to fix that than exempt these tests under a hypothetical "set -o pipefail" test mode. It looks like we probably won't have that, but once we've dug this code up let's refactor it[2] so we don't hide a potential pipe failure. 1. https://lore.kernel.org/git/xmqqzh18o8o6.fsf@gitster.c.googlers.com/ Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5703-upload-pack-ref-in-want.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh index eab966985b..5d825b1781 100755 --- a/t/t5703-upload-pack-ref-in-want.sh +++ b/t/t5703-upload-pack-ref-in-want.sh @@ -16,7 +16,8 @@ get_actual_commits () { test-tool pkt-line unpack-sideband o.pack && git index-pack o.pack && git verify-pack -v o.idx >objs && - grep commit objs | cut -d" " -f1 | sort >actual_commits + sed -n -e 's/\([0-9a-f][0-9a-f]*\) commit .*/\1/p' objs >objs.sed && + sort >actual_commits X-Patchwork-Id: 12041553 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 BD1D0C433E0 for ; Sat, 23 Jan 2021 13:03:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98C9222CB2 for ; Sat, 23 Jan 2021 13:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725968AbhAWNC6 (ORCPT ); Sat, 23 Jan 2021 08:02:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbhAWNCc (ORCPT ); Sat, 23 Jan 2021 08:02:32 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4040C0617AA for ; Sat, 23 Jan 2021 05:01:13 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id c128so6707495wme.2 for ; Sat, 23 Jan 2021 05:01:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dCv8Vm3E5bnMX9AUxXBz0tqO2Ex0WNF6fvpf+abNb3w=; b=vTtiDE+7Zpfv7RwMSSykw4JQavYNPYr9JVEpPku83pO5mpk1cIcwpTug8zwjJsYMXe xm7yKq25c8a4/yVRq4ru5Q4rTtnlcylZbKxhVivEsd7eZ7ZzLe2ZE+Mlrqt4XxWVV5bR 2zsIqqrz083v01rJbxBbamrQGlQuUFZzUFUOLgAbl3tjZjSnyGl/Cp4XDAToMmgvUqCk kzFZGt3wFGFSb33q9knFqz661M6FdLpdCHeWIrlUYxD3iP/lqqUKAac9VrzdJ14S79+A HMOtpBrG49pc6ac+ZnWLzgkqSiTmkgYWgGapR1C4z3rQIb7+wCZ+0OzWFmMdaGSG450x HNWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dCv8Vm3E5bnMX9AUxXBz0tqO2Ex0WNF6fvpf+abNb3w=; b=aJJz62nMbr4I6EPbpIHtZ6QuWI+QegdVeVK6VYrwi8XCBHzcMpdlOuqVV8Ubj2mmhG WIgpeK4YvGZODbvzUMlo4o7F/vaOq3krGnOaq/uPXyit/DIHbpSxXnJPinHBkenfMLe9 awV3aJDVHW3fAGxZemF6hVGggBP7JIshYPKRpUGmANtO/YVnYzyqNKFofpZ8WAkoLtKV Qkl777oy7jSbNrZZUPXFDguSM4OEnRSEf1xUJPOgCHEGyFCnjJ0mkdtQLEKGyk6KHDlw fN+lfYdUF6O2Vx8gmEiAV5iEZqJxdT19c5t/Ah06OvIkFSoGfq2ewS6yj/pwh2yOJDGN 4wHQ== X-Gm-Message-State: AOAM533EjjjuoAFiztX9XlwzFGT9UKqk0JdP4aHPnY3BbWwU8qHnnlLQ GIbMgVfDODxL39178EVoud8hJ/gWohHh9w== X-Google-Smtp-Source: ABdhPJyGHJvULOcmTw8jfmqKqCtgZyQEhlkqCp1wWNW1YjH4nv1lAsrOvijJUyMCUnsPeX6ADTnBng== X-Received: by 2002:a7b:c210:: with SMTP id x16mr7912587wmi.105.1611406872480; Sat, 23 Jan 2021 05:01:12 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c7sm16750319wro.16.2021.01.23.05.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 05:01:11 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Denton Liu , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 09/10] archive tests: use a cheaper "zipinfo -h" invocation to get header Date: Sat, 23 Jan 2021 14:00:45 +0100 Message-Id: <20210123130046.21975-10-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <87sg6s6lrs.fsf@evledraar.gmail.com> References: <87sg6s6lrs.fsf@evledraar.gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change an invocation of zipinfo added in 19ee29401d (t5004: test ZIP archives with many entries, 2015-08-22) to simply ask zipinfo for the header info, rather than spewing out info about the entire archive and race to kill it with SIGPIPE due to the downstream "head -2". I ran across this because I'm adding a "set -o pipefail" test mode. This won't be needed for the version of the mode that I'm introducing (which currently relies on a patch to GNU bash), but I think this is a good idea anyway. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5004-archive-corner-cases.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh index 3e7b23cb32..2d32d0ed12 100755 --- a/t/t5004-archive-corner-cases.sh +++ b/t/t5004-archive-corner-cases.sh @@ -153,7 +153,8 @@ test_expect_success ZIPINFO 'zip archive with many entries' ' # check the number of entries in the ZIP file directory expr 65536 + 256 >expect && - "$ZIPINFO" many.zip | head -2 | sed -n "2s/.* //p" >actual && + "$ZIPINFO" -h many.zip >zipinfo && + sed -n "2s/.* //p" actual && test_cmp expect actual ' From patchwork Sat Jan 23 13:00:46 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: 12041551 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 84189C433E0 for ; Sat, 23 Jan 2021 13:02:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5ECC522CB2 for ; Sat, 23 Jan 2021 13:02:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725891AbhAWNCy (ORCPT ); Sat, 23 Jan 2021 08:02:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725910AbhAWNCc (ORCPT ); Sat, 23 Jan 2021 08:02:32 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8279C0617AB for ; Sat, 23 Jan 2021 05:01:14 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id j18so6591011wmi.3 for ; Sat, 23 Jan 2021 05:01:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XYlebPiimKWpyZOySik7cVCMHlKoyzQf+oXTupRcTcI=; b=NpDH90dYlRExXl0mV5SWlkHas0hecIoGtrkk4myfN/uCl80+qo15U0ucEYXZB3/8Vp nViV0HH0m6uq9ujeJVHxv7BuZUP90mhJ2ybSFBJ5GfMGFyKqvyPPfD+ypHZDXoEzGXon q2VXizV83BG85SxLQTK+6k+J1kx6Xzu6GdQ0F5cYXytNJwZZpGwuTmeBo4MQc8iwBZxs iN0COC9a8LnfaSJja4vFyR3rhCj6/8kD7EV25aMsGn0U6EfIhYE4zV4azAusHLWeZrWP ijClWiKnDWJRRtKmtJtGFMo/mUsKZ8KjiFcDe1f5Bc5WjVtbxHSvUP843oUfFp0Zw7q6 dfUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XYlebPiimKWpyZOySik7cVCMHlKoyzQf+oXTupRcTcI=; b=qSi33WSE9XO17MC+GeCPY58e5kvJVQoYWx4xWtrhMZ+vlSVYICI9AXVE7MyzavaWdQ vHC8HpgZTymdP+ty1KLKWqy3kkUhPDKTbyLanHKHfxCRcVk09zmF/F8mERC9r+YObk1t Yj63AglAe6xJlmrF0GNMYJ/y4p5S21YaRRpdKhedmVnbLw6kWkWbsGlIaV2oxyT1AQJt G2oGNnuTwtiTk9OCqsyVgBwmh1EujKxSYtK0gkefbOiZdjk6tSei1OgHeSklq/vhpppi 5TCX6+n4kxzWTgyZZYQ1AzCpoUJMnHcrIGlY8FUxjeK/Ep7NVQ4V8xFSJqdIl9y6FMPu VLqg== X-Gm-Message-State: AOAM533pkD5zCZJVoJK2lskjxQaK7XCUhiQ/uJfqrqze0ySK2hrcPAHF 8G350b4vn1wacWQXVgoJK25wbb5yfYZ1+w== X-Google-Smtp-Source: ABdhPJxVhV1+j99JpOWvxeLSwlDU7VHmooKFjrdCGMbL3SzQG+xzKF6Q0yK46Jt3wpYyQWRDuVGhAw== X-Received: by 2002:a1c:18d:: with SMTP id 135mr8128300wmb.33.1611406873394; Sat, 23 Jan 2021 05:01:13 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c7sm16750319wro.16.2021.01.23.05.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 05:01:12 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Denton Liu , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 10/10] rm tests: actually test for SIGPIPE in SIGPIPE test Date: Sat, 23 Jan 2021 14:00:46 +0100 Message-Id: <20210123130046.21975-11-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <87sg6s6lrs.fsf@evledraar.gmail.com> References: <87sg6s6lrs.fsf@evledraar.gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change a test initially added in 50cd31c652 (t3600: comment on inducing SIGPIPE in `git rm`, 2019-11-27) to explicitly test for SIGPIPE using a pattern initially established in 7559a1be8a (unblock and unignore SIGPIPE, 2014-09-18). The problem with using that pattern is that it requires us to skip the test on MINGW[1]. If we kept the test with its initial semantics[2] we'd get coverage there, at the cost of not checking whether we actually had SIGPIPE outside of MinGW. Arguably we should just remove this test. Between the test added in 7559a1be8a and the change made in 12e0437f23 (common-main: call restore_sigpipe_to_default(), 2016-07-01) it's a bit arbitrary to only check this for "git rm". But in lieu of having wider test coverage for other "git" subcommands let's refactor this to explicitly test for SIGPIPE outside of MinGW, and then just that we remove the ".git/index.lock" (as before) on all platforms. 1. https://lore.kernel.org/git/xmqq1rec5ckf.fsf@gitster.c.googlers.com/ 2. 0693f9ddad (Make sure lockfiles are unlocked when dying on SIGPIPE, 2008-12-18) Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t3600-rm.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index efec8d13b6..185e39c390 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -240,7 +240,7 @@ test_expect_success 'refresh index before checking if it is up-to-date' ' test_path_is_missing frotz/nitfol ' -test_expect_success 'choking "git rm" should not let it die with cruft' ' +choke_git_rm_setup() { git reset -q --hard && test_when_finished "rm -f .git/index.lock && git reset -q --hard" && i=0 && @@ -249,12 +249,24 @@ test_expect_success 'choking "git rm" should not let it die with cruft' ' do echo "100644 $hash 0 some-file-$i" i=$(( $i + 1 )) - done | git update-index --index-info && + done | git update-index --index-info +} + +test_expect_success 'choking "git rm" should not let it die with cruft (induce SIGPIPE)' ' + choke_git_rm_setup && # git command is intentionally placed upstream of pipe to induce SIGPIPE git rm -n "some-file-*" | : && test_path_is_missing .git/index.lock ' + +test_expect_success !MINGW 'choking "git rm" should not let it die with cruft (induce and check SIGPIPE)' ' + choke_git_rm_setup && + OUT=$( ((trap "" PIPE; git rm -n "some-file-*"; echo $? 1>&3) | :) 3>&1 ) && + test_match_signal 13 "$OUT" && + test_path_is_missing .git/index.lock +' + test_expect_success 'Resolving by removal is not a warning-worthy event' ' git reset -q --hard && test_when_finished "rm -f .git/index.lock msg && git reset -q --hard" &&