From patchwork Mon Sep 17 22:24:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew DeVore X-Patchwork-Id: 10603507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45F8615A6 for ; Mon, 17 Sep 2018 22:24:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38FD42A2E6 for ; Mon, 17 Sep 2018 22:24:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D12A2A794; Mon, 17 Sep 2018 22:24:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32BDE2A2E6 for ; Mon, 17 Sep 2018 22:24:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728650AbeIRDyF (ORCPT ); Mon, 17 Sep 2018 23:54:05 -0400 Received: from mail-yw1-f73.google.com ([209.85.161.73]:34616 "EHLO mail-yw1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728088AbeIRDyE (ORCPT ); Mon, 17 Sep 2018 23:54:04 -0400 Received: by mail-yw1-f73.google.com with SMTP id p127-v6so8376841ywg.1 for ; Mon, 17 Sep 2018 15:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=e85kF+h3LIk58Of7HsAkVsp2JRMtN+KwRXGanYfiTtY=; b=Q4lB1BR11vReMx3x0l4i/G0166LMBVoahixcmFimxov4qGGntw+RqUg6D3DpBxL48K L1wQqmjFhx1os/PbFZQqvm22c9EQZV+86TXPwJFne8UKdbt64uLgCkbahcnWni+nMbnD nGA3zvkF5OOWigrbnvGz/tAgHuhPcqJgmGlW+tzuSdDDTm/xlKs0126PTDJxeDUDPbqd PPyfZNZkQ6HPepp2Gzynr1I2mx8rcDRbcY80PAStLoCpzzVHeMOU6/EV6fvCcK0g50j1 iUw/YzGYcjg717Yn/gFXBIhoHaLe1lWuskO4whisPDcCLPiTVnCmFD0ZAhVtTXDhYk/Z VPTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=e85kF+h3LIk58Of7HsAkVsp2JRMtN+KwRXGanYfiTtY=; b=oek9CTbLkB3IFozqWek3hH+qLB0Xy+4UPxrqx5kaZy8nsdrnficFsISBZCmmoroJv1 GuhDRkc3DxG8j8P9cDHiJq8H6FI/2nsr39W3LQkE77XWLLCFvzqHfYwmmawBXCnIX/Ch OQGI/VRyZAbw3appmh9z9HYYaDmTePlx713XVUUHzC6hWFUYdgG6mk0nzSR3GLx3m75m im9GZQwMuYGxRy7KTGFkCd0wzroYLy/Z5rEnWSvOXtJyIhgszgybL+RZaLxnNytNptxh wDx6WeNyYPegaX4IQc0m/b3//FQVEu8TQ3Xt5y5vCcA4P9VEOw3iewtTj42S76HnhbGT +94w== X-Gm-Message-State: APzg51DZcMgjfofn3mDpNJVlMHyAyPt4fLRG3vwvyrfx4n/UfQdKa/ro 6mKEVXpEj9TGI2tZuWuu+mPcrJKRQmXDffI3O4+x7Ou22d8hZCSFyQpGQQiApHSHxiOOtsbdKvv VdqafjMJipJFbqoYCQjyyCfzTanfqcxEPW9WtSYWPLn/GSJTqKX/U0Fzk4xY= X-Google-Smtp-Source: ANB0VdZOrZgzgpsLiJhGetj5sH/7fbPcy7ucdFkM8SKqDTQ6eEXhWsl0uhVJPxDV1IbaEH299TXmSeLbIYoQ X-Received: by 2002:a81:ae1c:: with SMTP id m28-v6mr3906905ywh.132.1537223085432; Mon, 17 Sep 2018 15:24:45 -0700 (PDT) Date: Mon, 17 Sep 2018 15:24:17 -0700 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog Subject: [PATCH v2 1/6] CodingGuidelines: add shell piping guidelines From: Matthew DeVore To: git@vger.kernel.org Cc: Matthew DeVore , peff@peff.net, jonathantanmy@google.com, gitster@pobox.com, jrn@google.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add two guidelines: - pipe characters should appear at the end of lines, and not cause indentation - pipes should be avoided when they swallow exit codes that can potentially fail --- Documentation/CodingGuidelines | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 48aa4edfb..7f903c1aa 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -163,6 +163,35 @@ For shell scripts specifically (not exhaustive): does not have such a problem. + - In a piped sequence which spans multiple lines, put each statement + on a separate line and put pipes on the end of each line, rather + than the start. This means you don't need to use \ to join lines, + since | implies a join already. Also, do not indent subsequent + lines; if you need a sequence to visually stand apart from the + surrounding code, use a blank line before and/or after the piped + sequence. + + (incorrect) + echo '...' > expected + git ls-files -s file.1 file.2 file.3 file.4 file.5 \ + | awk '{print $1}' \ + | sort >observed + test_cmp expected actual + + (correct) + echo '...' > expected + + git ls-files -s file.1 file.2 file.3 file.4 file.5 | + awk '{print $1}' | + sort >observed + + test_cmp expected actual + + - In a pipe, any non-zero exit codes returned by processes besides + the last will be ignored. If there is any possibility some + non-final command in the pipe will raise an error, prefer writing + the output of that command to a temporary file with '>' rather than + pipe it. For C programs: From patchwork Mon Sep 17 22:24:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew DeVore X-Patchwork-Id: 10603509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6515B17D5 for ; Mon, 17 Sep 2018 22:24:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54CF32A2E6 for ; Mon, 17 Sep 2018 22:24:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47CD92A78C; Mon, 17 Sep 2018 22:24:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74A5B2A2E6 for ; Mon, 17 Sep 2018 22:24:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728654AbeIRDyO (ORCPT ); Mon, 17 Sep 2018 23:54:14 -0400 Received: from mail-qt0-f201.google.com ([209.85.216.201]:53491 "EHLO mail-qt0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728088AbeIRDyO (ORCPT ); Mon, 17 Sep 2018 23:54:14 -0400 Received: by mail-qt0-f201.google.com with SMTP id d18-v6so15720513qtj.20 for ; Mon, 17 Sep 2018 15:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=kHkKxOkRDnZhwOhLV+ZTSHTVZe8VmRvSNdQSZ/SQKGw=; b=u95iobnqHf8chrcSK7FJaCak/LSaMT+IVS38JQAvUi76uB5CdWtR0iqX635LQZYoQy kB8HDdPpUQ/vFP2lNev8TgPYZ8lzjfhluRkH/DMwaDqoGp0A+/gGjLFDp6MaR5fr+wZL x9K4DcnzZ5qB3ZBe0xh/xvlVsscuSiR0J/fr8xVov/dDjumgki2G7uhY8rJhMH5zptTR yU8IUX0THPxw9qc9Rbw2lUB6dTjW4NGqmjfpisgNtzhK+RlC6I8KnB2G9sIoygJ/nift QN8tige2ogr5/AAMv5aaFmgdBGlDpDWEcXVAxMtYUHRzxBu8V6j07OuC9rm/mFYT4IyB 8GTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=kHkKxOkRDnZhwOhLV+ZTSHTVZe8VmRvSNdQSZ/SQKGw=; b=oA2q9TiOEaQeKln4Zn1Xn2aKyzcTh35AMhPxay2v0Jy66VGKU8/DJzGVXPKcCWrz1l hPt/56bEdzPPHSGTyQVScU6y4C7WqT3PrLmrxLtpzX2LYonrLmEQrg7YLdStXoUg+g4b FU+PQIt7x4lOTCefvBfgIN9aW/BEIujeOFk+Cfvvz4qSzbOlVQMlFuuD72uws+vExcJF 5vV5ALUfPHiNDjvKpPlNRe0UmjtvzWBGqC9Q4Dwb0aX8j2FwtijTgUdnfTpYrYt3sENx 884ZZYWkJyf0JCM16oRxMuwxyaV1AYOVCsVa3wXf+mqx6NjQS95d6XqJIXHrxmPUANhI Rv9g== X-Gm-Message-State: APzg51AR5IzsGRyqx4PHI+OTGKPn3GOKJ/OHnNSn7yPJAnK8ufnO35P5 9Yb7tMaMHgyK7vjqYDp/DZcvkmRrlyqcd/FPgrH7EntPIDSdu3mLz8pqpBIkn+uau6Qvm5R/QGI yP7qB9H7JaOtx+8/nIdC9qM6hcb+8LCfp+rsXd1XBk+3cLK2nQvJE65zHAOA= X-Google-Smtp-Source: ANB0VdbntZlnXlQFwzN+Dy4DdOIMkzAYuCOHEveC7VxzLhzNrCtGW++9eWXvfjgJub4Czr5NV68HKzgHmfb9 X-Received: by 2002:ac8:592:: with SMTP id a18-v6mr8893355qth.43.1537223094160; Mon, 17 Sep 2018 15:24:54 -0700 (PDT) Date: Mon, 17 Sep 2018 15:24:18 -0700 In-Reply-To: Message-Id: <980e4d6005224771cf9366883f2493ef0a82e8c8.1537223021.git.matvore@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog Subject: [PATCH v2 2/6] tests: standardize pipe placement From: Matthew DeVore To: git@vger.kernel.org Cc: Matthew DeVore , peff@peff.net, jonathantanmy@google.com, gitster@pobox.com, jrn@google.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of using a line-continuation and pipe on the second line, take advantage of the shell's implicit line continuation after a pipe character. So for example, instead of some long line \ | next line use some long line | next line And add a blank line before and after the pipe where it aids readability (it usually does). This better matches the coding style documented in Documentation/CodingGuidelines and used in shell scripts elsewhere in the tree. Signed-off-by: Matthew DeVore --- t/lib-gpg.sh | 9 +- t/t1006-cat-file.sh | 8 +- t/t1300-config.sh | 5 +- t/t5317-pack-objects-filter-objects.sh | 330 ++++++++++++++----------- t/t5500-fetch-pack.sh | 5 +- t/t5616-partial-clone.sh | 32 ++- t/t6112-rev-list-filters-objects.sh | 203 ++++++++------- 7 files changed, 342 insertions(+), 250 deletions(-) diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh index 3fe02876c..f1277bef4 100755 --- a/t/lib-gpg.sh +++ b/t/lib-gpg.sh @@ -57,9 +57,12 @@ then echo | gpgsm --homedir "${GNUPGHOME}" 2>/dev/null \ --passphrase-fd 0 --pinentry-mode loopback \ --import "$TEST_DIRECTORY"/lib-gpg/gpgsm_cert.p12 && - gpgsm --homedir "${GNUPGHOME}" 2>/dev/null -K \ - | grep fingerprint: | cut -d" " -f4 | tr -d '\n' > \ - ${GNUPGHOME}/trustlist.txt && + + gpgsm --homedir "${GNUPGHOME}" 2>/dev/null -K | + grep fingerprint: | + cut -d" " -f4 | + tr -d '\n' >"${GNUPGHOME}/trustlist.txt" && + echo " S relax" >> ${GNUPGHOME}/trustlist.txt && (gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) && echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \ diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh index 7f19d591f..a0fa926d3 100755 --- a/t/t1006-cat-file.sh +++ b/t/t1006-cat-file.sh @@ -218,8 +218,8 @@ test_expect_success "--batch-check for a non-existent hash" ' test "0000000000000000000000000000000000000042 missing 0000000000000000000000000000000000000084 missing" = \ "$( ( echo 0000000000000000000000000000000000000042; - echo_without_newline 0000000000000000000000000000000000000084; ) \ - | git cat-file --batch-check)" + echo_without_newline 0000000000000000000000000000000000000084; ) | + git cat-file --batch-check)" ' test_expect_success "--batch for an existent and a non-existent hash" ' @@ -227,8 +227,8 @@ test_expect_success "--batch for an existent and a non-existent hash" ' $tag_content 0000000000000000000000000000000000000000 missing" = \ "$( ( echo $tag_sha1; - echo_without_newline 0000000000000000000000000000000000000000; ) \ - | git cat-file --batch)" + echo_without_newline 0000000000000000000000000000000000000000; ) | + git cat-file --batch)" ' test_expect_success "--batch-check for an empty line" ' diff --git a/t/t1300-config.sh b/t/t1300-config.sh index cdf1fed5d..5869d6cb6 100755 --- a/t/t1300-config.sh +++ b/t/t1300-config.sh @@ -1770,8 +1770,9 @@ test_expect_success '--show-origin stdin with file include' ' cat >expect <<-EOF && file:$INCLUDE_DIR/stdin.include include EOF - echo "[include]path=\"$INCLUDE_DIR\"/stdin.include" \ - | git config --show-origin --includes --file - user.stdin >output && + echo "[include]path=\"$INCLUDE_DIR\"/stdin.include" | + git config --show-origin --includes --file - user.stdin >output && + test_cmp expect output ' diff --git a/t/t5317-pack-objects-filter-objects.sh b/t/t5317-pack-objects-filter-objects.sh index 6710c8bc8..ce69148ec 100755 --- a/t/t5317-pack-objects-filter-objects.sh +++ b/t/t5317-pack-objects-filter-objects.sh @@ -20,17 +20,20 @@ test_expect_success 'setup r1' ' ' test_expect_success 'verify blob count in normal packfile' ' - git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 | + awk -f print_2.awk | + sort >expected && + git -C r1 pack-objects --rev --stdout >all.pack <<-EOF && HEAD EOF git -C r1 index-pack ../all.pack && - git -C r1 verify-pack -v ../all.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r1 verify-pack -v ../all.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' @@ -39,23 +42,27 @@ test_expect_success 'verify blob:none packfile has no blobs' ' HEAD EOF git -C r1 index-pack ../filter.pack && - git -C r1 verify-pack -v ../filter.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r1 verify-pack -v ../filter.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + nr=$(wc -l expected && - git -C r1 verify-pack -v ../filter.pack \ - | grep -E "commit|tree" \ - | awk -f print_1.awk \ - | sort >observed && + git -C r1 verify-pack -v ../all.pack | + grep -E "commit|tree" | + awk -f print_1.awk | + sort >expected && + + git -C r1 verify-pack -v ../filter.pack | + grep -E "commit|tree" | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' @@ -75,17 +82,20 @@ test_expect_success 'setup r2' ' ' test_expect_success 'verify blob count in normal packfile' ' - git -C r2 ls-files -s large.1000 large.10000 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r2 ls-files -s large.1000 large.10000 | + awk -f print_2.awk | + sort >expected && + git -C r2 pack-objects --rev --stdout >all.pack <<-EOF && HEAD EOF git -C r2 index-pack ../all.pack && - git -C r2 verify-pack -v ../all.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r2 verify-pack -v ../all.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' @@ -94,10 +104,12 @@ test_expect_success 'verify blob:limit=500 omits all blobs' ' HEAD EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r2 verify-pack -v ../filter.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + nr=$(wc -l observed && + + git -C r2 verify-pack -v ../filter.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + nr=$(wc -l expected && + git -C r2 ls-files -s large.1000 | + awk -f print_2.awk | + sort >expected && + git -C r2 pack-objects --rev --stdout --filter=blob:limit=1001 >filter.pack <<-EOF && HEAD EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r2 verify-pack -v ../filter.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify blob:limit=10001' ' - git -C r2 ls-files -s large.1000 large.10000 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r2 ls-files -s large.1000 large.10000 | + awk -f print_2.awk | + sort >expected && + git -C r2 pack-objects --rev --stdout --filter=blob:limit=10001 >filter.pack <<-EOF && HEAD EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r2 verify-pack -v ../filter.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify blob:limit=1k' ' - git -C r2 ls-files -s large.1000 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r2 ls-files -s large.1000 | + awk -f print_2.awk | + sort >expected && + git -C r2 pack-objects --rev --stdout --filter=blob:limit=1k >filter.pack <<-EOF && HEAD EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r2 verify-pack -v ../filter.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify explicitly specifying oversized blob in input' ' - git -C r2 ls-files -s large.1000 large.10000 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r2 ls-files -s large.1000 large.10000 | + awk -f print_2.awk | + sort >expected && + git -C r2 pack-objects --rev --stdout --filter=blob:limit=1k >filter.pack <<-EOF && HEAD $(git -C r2 rev-parse HEAD:large.10000) EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r2 verify-pack -v ../filter.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify blob:limit=1m' ' - git -C r2 ls-files -s large.1000 large.10000 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r2 ls-files -s large.1000 large.10000 | + awk -f print_2.awk | + sort >expected && + git -C r2 pack-objects --rev --stdout --filter=blob:limit=1m >filter.pack <<-EOF && HEAD EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r2 verify-pack -v ../filter.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify normal and blob:limit packfiles have same commits/trees' ' - git -C r2 verify-pack -v ../all.pack \ - | grep -E "commit|tree" \ - | awk -f print_1.awk \ - | sort >expected && - git -C r2 verify-pack -v ../filter.pack \ - | grep -E "commit|tree" \ - | awk -f print_1.awk \ - | sort >observed && + git -C r2 verify-pack -v ../all.pack | + grep -E "commit|tree" | + awk -f print_1.awk | + sort >expected && + + git -C r2 verify-pack -v ../filter.pack | + grep -E "commit|tree" | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' @@ -224,71 +255,84 @@ test_expect_success 'setup r3' ' ' test_expect_success 'verify blob count in normal packfile' ' - git -C r3 ls-files -s sparse1 sparse2 dir1/sparse1 dir1/sparse2 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r3 ls-files -s sparse1 sparse2 dir1/sparse1 dir1/sparse2 | + awk -f print_2.awk | + sort >expected && + git -C r3 pack-objects --rev --stdout >all.pack <<-EOF && HEAD EOF git -C r3 index-pack ../all.pack && - git -C r3 verify-pack -v ../all.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r3 verify-pack -v ../all.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify sparse:path=pattern1' ' - git -C r3 ls-files -s dir1/sparse1 dir1/sparse2 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r3 ls-files -s dir1/sparse1 dir1/sparse2 | + awk -f print_2.awk | + sort >expected && + git -C r3 pack-objects --rev --stdout --filter=sparse:path=../pattern1 >filter.pack <<-EOF && HEAD EOF git -C r3 index-pack ../filter.pack && - git -C r3 verify-pack -v ../filter.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r3 verify-pack -v ../filter.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify normal and sparse:path=pattern1 packfiles have same commits/trees' ' - git -C r3 verify-pack -v ../all.pack \ - | grep -E "commit|tree" \ - | awk -f print_1.awk \ - | sort >expected && - git -C r3 verify-pack -v ../filter.pack \ - | grep -E "commit|tree" \ - | awk -f print_1.awk \ - | sort >observed && + git -C r3 verify-pack -v ../all.pack | + grep -E "commit|tree" | + awk -f print_1.awk | + sort >expected && + + git -C r3 verify-pack -v ../filter.pack | + grep -E "commit|tree" | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify sparse:path=pattern2' ' - git -C r3 ls-files -s sparse1 dir1/sparse1 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r3 ls-files -s sparse1 dir1/sparse1 | + awk -f print_2.awk | + sort >expected && + git -C r3 pack-objects --rev --stdout --filter=sparse:path=../pattern2 >filter.pack <<-EOF && HEAD EOF git -C r3 index-pack ../filter.pack && - git -C r3 verify-pack -v ../filter.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r3 verify-pack -v ../filter.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify normal and sparse:path=pattern2 packfiles have same commits/trees' ' - git -C r3 verify-pack -v ../all.pack \ - | grep -E "commit|tree" \ - | awk -f print_1.awk \ - | sort >expected && - git -C r3 verify-pack -v ../filter.pack \ - | grep -E "commit|tree" \ - | awk -f print_1.awk \ - | sort >observed && + git -C r3 verify-pack -v ../all.pack | + grep -E "commit|tree" | + awk -f print_1.awk | + sort >expected && + + git -C r3 verify-pack -v ../filter.pack | + grep -E "commit|tree" | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' @@ -312,48 +356,57 @@ test_expect_success 'setup r4' ' ' test_expect_success 'verify blob count in normal packfile' ' - git -C r4 ls-files -s pattern sparse1 sparse2 dir1/sparse1 dir1/sparse2 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r4 ls-files -s pattern sparse1 sparse2 dir1/sparse1 dir1/sparse2 | + awk -f print_2.awk | + sort >expected && + git -C r4 pack-objects --rev --stdout >all.pack <<-EOF && HEAD EOF git -C r4 index-pack ../all.pack && - git -C r4 verify-pack -v ../all.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r4 verify-pack -v ../all.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify sparse:oid=OID' ' - git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 | + awk -f print_2.awk | + sort >expected && + oid=$(git -C r4 ls-files -s pattern | awk -f print_2.awk) && git -C r4 pack-objects --rev --stdout --filter=sparse:oid=$oid >filter.pack <<-EOF && HEAD EOF git -C r4 index-pack ../filter.pack && - git -C r4 verify-pack -v ../filter.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r4 verify-pack -v ../filter.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify sparse:oid=oid-ish' ' - git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 | + awk -f print_2.awk | + sort >expected && + git -C r4 pack-objects --rev --stdout --filter=sparse:oid=master:pattern >filter.pack <<-EOF && HEAD EOF git -C r4 index-pack ../filter.pack && - git -C r4 verify-pack -v ../filter.pack \ - | grep blob \ - | awk -f print_1.awk \ - | sort >observed && + + git -C r4 verify-pack -v ../filter.pack | + grep blob | + awk -f print_1.awk | + sort >observed && + test_cmp observed expected ' @@ -361,9 +414,10 @@ test_expect_success 'verify sparse:oid=oid-ish' ' # This models previously omitted objects that we did not receive. test_expect_success 'setup r1 - delete loose blobs' ' - git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 | + awk -f print_2.awk | + sort >expected && + for id in `cat expected | sed "s|..|&/|"` do rm r1/.git/objects/$id diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 1b5a4a6d3..5ac6f286d 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -50,8 +50,9 @@ pull_to_client () { case "$heads" in *B*) git update-ref refs/heads/B "$BTIP";; esac && - git symbolic-ref HEAD refs/heads/$(echo $heads \ - | sed -e "s/^\(.\).*$/\1/") && + + git symbolic-ref HEAD refs/heads/$(echo $heads | + sed -e "s/^\(.\).*$/\1/") && git fsck --full && diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh index bbbe7537d..e4d032c9d 100755 --- a/t/t5616-partial-clone.sh +++ b/t/t5616-partial-clone.sh @@ -34,10 +34,12 @@ test_expect_success 'setup bare clone for server' ' # confirm partial clone was registered in the local config. test_expect_success 'do partial clone 1' ' git clone --no-checkout --filter=blob:none "file://$(pwd)/srv.bare" pc1 && - git -C pc1 rev-list HEAD --quiet --objects --missing=print \ - | awk -f print_1.awk \ - | sed "s/?//" \ - | sort >observed.oids && + + git -C pc1 rev-list HEAD --quiet --objects --missing=print | + awk -f print_1.awk | + sed "s/?//" | + sort >observed.oids && + test_cmp expect_1.oids observed.oids && test "$(git -C pc1 config --local core.repositoryformatversion)" = "1" && test "$(git -C pc1 config --local extensions.partialclone)" = "origin" && @@ -130,16 +132,20 @@ test_expect_success 'push new commits to server for file.3.txt' ' # perhaps combined with a command in dry-run mode. test_expect_success 'manual prefetch of missing objects' ' git -C pc1 fetch --filter=blob:none origin && - git -C pc1 rev-list master..origin/master --quiet --objects --missing=print \ - | awk -f print_1.awk \ - | sed "s/?//" \ - | sort >observed.oids && + + git -C pc1 rev-list master..origin/master --quiet --objects --missing=print | + awk -f print_1.awk | + sed "s/?//" | + sort >observed.oids && + test_line_count = 6 observed.oids && git -C pc1 fetch-pack --stdin "file://$(pwd)/srv.bare" observed.oids && + + git -C pc1 rev-list master..origin/master --quiet --objects --missing=print | + awk -f print_1.awk | + sed "s/?//" | + sort >observed.oids && + test_line_count = 0 observed.oids ' @@ -194,7 +200,7 @@ test_expect_success 'upon cloning, check that all refs point to objects' ' # Craft a packfile not including that blob. git -C "$SERVER" rev-parse HEAD | - git -C "$SERVER" pack-objects --stdout >incomplete.pack && + git -C "$SERVER" pack-objects --stdout >incomplete.pack && # Replace the existing packfile with the crafted one. The protocol # requires that the packfile be sent in sideband 1, hence the extra diff --git a/t/t6112-rev-list-filters-objects.sh b/t/t6112-rev-list-filters-objects.sh index d4ff0b3be..0f6b569e1 100755 --- a/t/t6112-rev-list-filters-objects.sh +++ b/t/t6112-rev-list-filters-objects.sh @@ -20,24 +20,28 @@ test_expect_success 'setup r1' ' ' test_expect_success 'verify blob:none omits all 5 blobs' ' - git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \ - | awk -f print_2.awk \ - | sort >expected && - git -C r1 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:none \ - | awk -f print_1.awk \ - | sed "s/~//" \ - | sort >observed && + git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 | + awk -f print_2.awk | + sort >expected && + + git -C r1 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:none | + awk -f print_1.awk | + sed "s/~//" | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify emitted+omitted == all' ' - git -C r1 rev-list HEAD --objects \ - | awk -f print_1.awk \ - | sort >expected && - git -C r1 rev-list HEAD --objects --filter-print-omitted --filter=blob:none \ - | awk -f print_1.awk \ - | sed "s/~//" \ - | sort >observed && + git -C r1 rev-list HEAD --objects | + awk -f print_1.awk | + sort >expected && + + git -C r1 rev-list HEAD --objects --filter-print-omitted --filter=blob:none | + awk -f print_1.awk | + sed "s/~//" | + sort >observed && + test_cmp observed expected ' @@ -58,65 +62,76 @@ test_expect_success 'setup r2' ' ' test_expect_success 'verify blob:limit=500 omits all blobs' ' - git -C r2 ls-files -s large.1000 large.10000 \ - | awk -f print_2.awk \ - | sort >expected && - git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=500 \ - | awk -f print_1.awk \ - | sed "s/~//" \ - | sort >observed && + git -C r2 ls-files -s large.1000 large.10000 | + awk -f print_2.awk | + sort >expected && + + git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=500 | + awk -f print_1.awk | + sed "s/~//" | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify emitted+omitted == all' ' - git -C r2 rev-list HEAD --objects \ - | awk -f print_1.awk \ - | sort >expected && - git -C r2 rev-list HEAD --objects --filter-print-omitted --filter=blob:limit=500 \ - | awk -f print_1.awk \ - | sed "s/~//" \ - | sort >observed && + git -C r2 rev-list HEAD --objects | + awk -f print_1.awk | + sort >expected && + + git -C r2 rev-list HEAD --objects --filter-print-omitted --filter=blob:limit=500 | + awk -f print_1.awk | + sed "s/~//" | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify blob:limit=1000' ' - git -C r2 ls-files -s large.1000 large.10000 \ - | awk -f print_2.awk \ - | sort >expected && - git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1000 \ - | awk -f print_1.awk \ - | sed "s/~//" \ - | sort >observed && + git -C r2 ls-files -s large.1000 large.10000 | + awk -f print_2.awk | + sort >expected && + + git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1000 | + awk -f print_1.awk | + sed "s/~//" | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify blob:limit=1001' ' - git -C r2 ls-files -s large.10000 \ - | awk -f print_2.awk \ - | sort >expected && - git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1001 \ - | awk -f print_1.awk \ - | sed "s/~//" \ - | sort >observed && + git -C r2 ls-files -s large.10000 | + awk -f print_2.awk | + sort >expected && + + git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1001 | + awk -f print_1.awk | + sed "s/~//" | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify blob:limit=1k' ' - git -C r2 ls-files -s large.10000 \ - | awk -f print_2.awk \ - | sort >expected && - git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1k \ - | awk -f print_1.awk \ - | sed "s/~//" \ - | sort >observed && + git -C r2 ls-files -s large.10000 | + awk -f print_2.awk | + sort >expected && + + git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1k | + awk -f print_1.awk | + sed "s/~//" | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify blob:limit=1m' ' - git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1m \ - | awk -f print_1.awk \ - | sed "s/~//" \ - | sort >observed && + git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1m | + awk -f print_1.awk | + sed "s/~//" | + sort >observed && + test_must_be_empty observed ' @@ -141,24 +156,28 @@ test_expect_success 'setup r3' ' ' test_expect_success 'verify sparse:path=pattern1 omits top-level files' ' - git -C r3 ls-files -s sparse1 sparse2 \ - | awk -f print_2.awk \ - | sort >expected && - git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:path=../pattern1 \ - | awk -f print_1.awk \ - | sed "s/~//" \ - | sort >observed && + git -C r3 ls-files -s sparse1 sparse2 | + awk -f print_2.awk | + sort >expected && + + git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:path=../pattern1 | + awk -f print_1.awk | + sed "s/~//" | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify sparse:path=pattern2 omits both sparse2 files' ' - git -C r3 ls-files -s sparse2 dir1/sparse2 \ - | awk -f print_2.awk \ - | sort >expected && - git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:path=../pattern2 \ - | awk -f print_1.awk \ - | sed "s/~//" \ - | sort >observed && + git -C r3 ls-files -s sparse2 dir1/sparse2 | + awk -f print_2.awk | + sort >expected && + + git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:path=../pattern2 | + awk -f print_1.awk | + sed "s/~//" | + sort >observed && + test_cmp observed expected ' @@ -173,25 +192,30 @@ test_expect_success 'setup r3 part 2' ' ' test_expect_success 'verify sparse:oid=OID omits top-level files' ' - git -C r3 ls-files -s pattern sparse1 sparse2 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r3 ls-files -s pattern sparse1 sparse2 | + awk -f print_2.awk | + sort >expected && + oid=$(git -C r3 ls-files -s pattern | awk -f print_2.awk) && - git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:oid=$oid \ - | awk -f print_1.awk \ - | sed "s/~//" \ - | sort >observed && + + git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:oid=$oid | + awk -f print_1.awk | + sed "s/~//" | + sort >observed && + test_cmp observed expected ' test_expect_success 'verify sparse:oid=oid-ish omits top-level files' ' - git -C r3 ls-files -s pattern sparse1 sparse2 \ - | awk -f print_2.awk \ - | sort >expected && - git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:oid=master:pattern \ - | awk -f print_1.awk \ - | sed "s/~//" \ - | sort >observed && + git -C r3 ls-files -s pattern sparse1 sparse2 | + awk -f print_2.awk | + sort >expected && + + git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:oid=master:pattern | + awk -f print_1.awk | + sed "s/~//" | + sort >observed && + test_cmp observed expected ' @@ -199,17 +223,20 @@ test_expect_success 'verify sparse:oid=oid-ish omits top-level files' ' # This models previously omitted objects that we did not receive. test_expect_success 'rev-list W/ --missing=print' ' - git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \ - | awk -f print_2.awk \ - | sort >expected && + git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 | + awk -f print_2.awk | + sort >expected && + for id in `cat expected | sed "s|..|&/|"` do rm r1/.git/objects/$id done && - git -C r1 rev-list --quiet HEAD --missing=print --objects \ - | awk -f print_1.awk \ - | sed "s/?//" \ - | sort >observed && + + git -C r1 rev-list --quiet HEAD --missing=print --objects | + awk -f print_1.awk | + sed "s/?//" | + sort >observed && + test_cmp observed expected ' From patchwork Mon Sep 17 22:24:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew DeVore X-Patchwork-Id: 10603513 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9422A15A6 for ; Mon, 17 Sep 2018 22:25:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 832D52A2E6 for ; Mon, 17 Sep 2018 22:25:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75C682A78C; Mon, 17 Sep 2018 22:25:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,LOTS_OF_MONEY,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26A5C2A2E6 for ; Mon, 17 Sep 2018 22:25:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728631AbeIRDyX (ORCPT ); Mon, 17 Sep 2018 23:54:23 -0400 Received: from mail-ua1-f73.google.com ([209.85.222.73]:37371 "EHLO mail-ua1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728655AbeIRDyW (ORCPT ); Mon, 17 Sep 2018 23:54:22 -0400 Received: by mail-ua1-f73.google.com with SMTP id w15-v6so5905246uao.4 for ; Mon, 17 Sep 2018 15:25:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=cHqDR2sfFtKuY1cl6RdI5JMhpYBgI3hu+wuG3dvJxec=; b=RPKbZawhgiN0B6haVrEK6ElzLyH3n8lvHhYvr90CVB64ZJByOF8yue015V+SiXnqmn Jd/XZtKKOIq5flbRUIGwne5YGIwFOtnSCl8s73Ls0tgOYZN4YiiyrHp6LxtF/sE5yv6G VqLHsPbaYHK8DlVCgmqMleC7JV1woa3IAjCxv8Kq5YPgfXx2CU9pnCZqEs86A3QT74kz 9f9LEhFLEoeg9380k/wi6n37J1ZOGOW4eeM1JMg7o/mCrbj0Xby8mqVqy1Y+E+ogSFKT uwiVGt/0jsWFuXIZisgFbQdz5cIO9IEF90HrSTtJd+UaNkPNX2kPp2C4KtnN2oEC5/Wu AxUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=cHqDR2sfFtKuY1cl6RdI5JMhpYBgI3hu+wuG3dvJxec=; b=jmVlRefrPz6UfY6b9L67itFdbstEvJ7NadZjvEVa4QbeoVbTLKIN8D/ip1SKU90G6o yUaMszFhEoSXyeeF7NAj4KI7x46vCxYQ9SXGrMT+cXEv6LNhGgNZIJzjNN6ofcEzIJMw jBpM6xALx7+xXlUMqRDohj0BwEXF4fes5X4HMtgjFfSk/q9MSCI6DMOC12vl5n4S7iID kbv8WLZj+tFknYfFDdIRIBuQbYSdOvQjyLgXTynDQ2zemHQ07AKNK3haJYx5Dj4NDFAR 7/rX5gmhBc7YkEhcd9XmXrdWoRBr3NlIhdYShyFTOwXM+YLTk/kWAoaMR2pcdTT8vhR0 1Q0Q== X-Gm-Message-State: APzg51D2k1R8k7pzSTMle5v9V/ktWobz2ObUUHB2YfMFt9mbwk4ca99f fQwH8DGCL0HCci7pQMp/ocr8rnwNWLAzHPyJqT4VtY9FSn2ZOSDs25wxoKB/nweH3ch06scvqm1 OpMtW4MLZQqdFGOrMMlIHnS8viTl4oJsnBq2DTpalUnQ+AgzysqU67aDaolU= X-Google-Smtp-Source: ANB0VdbdRzjTH8WNst/ywwn9Abh5CaD+fwXhzVXVkujg8Vgtfx/7BI5mO+jdYjKK3yeeoIVGUAJK6g05rOPs X-Received: by 2002:a67:3f0b:: with SMTP id m11-v6mr5477601vsa.25.1537223102868; Mon, 17 Sep 2018 15:25:02 -0700 (PDT) Date: Mon, 17 Sep 2018 15:24:19 -0700 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog Subject: [PATCH v2 3/6] t/*: fix ordering of expected/observed arguments From: Matthew DeVore To: git@vger.kernel.org Cc: Matthew DeVore , peff@peff.net, jonathantanmy@google.com, gitster@pobox.com, jrn@google.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix various places where the ordering was obviously wrong, meaning it was easy to find with grep. Signed-off-by: Matthew DeVore --- t/t0000-basic.sh | 2 +- t/t0021-conversion.sh | 4 +-- t/t1300-config.sh | 4 +-- t/t1303-wacky-config.sh | 4 +-- t/t2101-update-index-reupdate.sh | 2 +- t/t3200-branch.sh | 2 +- t/t3320-notes-merge-worktrees.sh | 4 +-- t/t3400-rebase.sh | 8 +++--- t/t3417-rebase-whitespace-fix.sh | 6 ++--- t/t3702-add-edit.sh | 4 +-- t/t3903-stash.sh | 8 +++--- t/t3905-stash-include-untracked.sh | 2 +- t/t4025-hunk-header.sh | 2 +- t/t4117-apply-reject.sh | 6 ++--- t/t4124-apply-ws-rule.sh | 30 +++++++++++------------ t/t4138-apply-ws-expansion.sh | 2 +- t/t5317-pack-objects-filter-objects.sh | 34 +++++++++++++------------- t/t5318-commit-graph.sh | 2 +- t/t5701-git-serve.sh | 14 +++++------ t/t5702-protocol-v2.sh | 10 ++++---- t/t6023-merge-file.sh | 12 ++++----- t/t6027-merge-binary.sh | 4 +-- t/t6031-merge-filemode.sh | 2 +- t/t6112-rev-list-filters-objects.sh | 24 +++++++++--------- t/t7201-co.sh | 4 +-- t/t7406-submodule-update.sh | 8 +++--- t/t7800-difftool.sh | 2 +- t/t9100-git-svn-basic.sh | 2 +- t/t9133-git-svn-nested-git-repo.sh | 6 ++--- t/t9600-cvsimport.sh | 2 +- t/t9603-cvsimport-patchsets.sh | 4 +-- t/t9604-cvsimport-timestamps.sh | 4 +-- 32 files changed, 112 insertions(+), 112 deletions(-) diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 850f651e4..224c098a8 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -1018,7 +1018,7 @@ test_expect_success SHA1 'validate git diff-files output for a know cache/work t :120000 120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0000000000000000000000000000000000000000 M path3/subp3/file3sym EOF git diff-files >current && - test_cmp current expected + test_cmp expected current ' test_expect_success 'git update-index --refresh should succeed' ' diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh index 308cd28f3..fd5f1ac64 100755 --- a/t/t0021-conversion.sh +++ b/t/t0021-conversion.sh @@ -166,10 +166,10 @@ test_expect_success expanded_in_repo ' rm -f expanded-keywords expanded-keywords-crlf && git checkout -- expanded-keywords && - test_cmp expanded-keywords expected-output && + test_cmp expected-output expanded-keywords && git checkout -- expanded-keywords-crlf && - test_cmp expanded-keywords-crlf expected-output-crlf + test_cmp expected-output-crlf expanded-keywords-crlf ' # The use of %f in a filter definition is expanded to the path to diff --git a/t/t1300-config.sh b/t/t1300-config.sh index 5869d6cb6..e2cd50ecf 100755 --- a/t/t1300-config.sh +++ b/t/t1300-config.sh @@ -1001,7 +1001,7 @@ EOF test_expect_success 'value continued on next line' ' git config --list > result && - test_cmp result expect + test_cmp expect result ' cat > .git/config <<\EOF @@ -1882,7 +1882,7 @@ test_expect_success '--replace-all does not invent newlines' ' Qkey = b EOF git config --replace-all abc.key b && - test_cmp .git/config expect + test_cmp expect .git/config ' test_done diff --git a/t/t1303-wacky-config.sh b/t/t1303-wacky-config.sh index 3b92083e1..0000e664e 100755 --- a/t/t1303-wacky-config.sh +++ b/t/t1303-wacky-config.sh @@ -14,7 +14,7 @@ setup() { check() { echo "$2" >expected git config --get "$1" >actual 2>&1 - test_cmp actual expected + test_cmp expected actual } # 'check section.key regex value' verifies that the entry for @@ -22,7 +22,7 @@ check() { check_regex() { echo "$3" >expected git config --get "$1" "$2" >actual 2>&1 - test_cmp actual expected + test_cmp expected actual } test_expect_success 'modify same key' ' diff --git a/t/t2101-update-index-reupdate.sh b/t/t2101-update-index-reupdate.sh index 685ec4563..6c32d42c8 100755 --- a/t/t2101-update-index-reupdate.sh +++ b/t/t2101-update-index-reupdate.sh @@ -73,7 +73,7 @@ test_expect_success 'update-index --update from subdir' ' 100644 $(git hash-object dir1/file3) 0 dir1/file3 100644 $file2 0 file2 EOF - test_cmp current expected + test_cmp expected current ' test_expect_success 'update-index --update with pathspec' ' diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 93f21ab07..478b82cf9 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -1221,7 +1221,7 @@ test_expect_success 'use --edit-description' ' EOF EDITOR=./editor git branch --edit-description && echo "New contents" >expect && - test_cmp EDITOR_OUTPUT expect + test_cmp expect EDITOR_OUTPUT ' test_expect_success 'detect typo in branch name when using --edit-description' ' diff --git a/t/t3320-notes-merge-worktrees.sh b/t/t3320-notes-merge-worktrees.sh index 10bfc8b94..823fdbda1 100755 --- a/t/t3320-notes-merge-worktrees.sh +++ b/t/t3320-notes-merge-worktrees.sh @@ -44,7 +44,7 @@ test_expect_success 'merge z into y fails and sets NOTES_MERGE_REF' ' git config core.notesRef refs/notes/y && test_must_fail git notes merge z && echo "ref: refs/notes/y" >expect && - test_cmp .git/NOTES_MERGE_REF expect + test_cmp expect .git/NOTES_MERGE_REF ' test_expect_success 'merge z into y while mid-merge in another workdir fails' ' @@ -66,7 +66,7 @@ test_expect_success 'merge z into x while mid-merge on y succeeds' ' grep -v "A notes merge into refs/notes/x is already in-progress in" out ) && echo "ref: refs/notes/x" >expect && - test_cmp .git/worktrees/worktree2/NOTES_MERGE_REF expect + test_cmp expect .git/worktrees/worktree2/NOTES_MERGE_REF ' test_done diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index 3996ee013..3e73f7584 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -183,13 +183,13 @@ test_expect_success 'cherry-picked commits and fork-point work together' ' test_commit final_B B "Final B" && git rebase && echo Amended >expect && - test_cmp A expect && + test_cmp expect A && echo "Final B" >expect && - test_cmp B expect && + test_cmp expect B && echo C >expect && - test_cmp C expect && + test_cmp expect C && echo D >expect && - test_cmp D expect + test_cmp expect D ' test_expect_success 'rebase -q is quiet' ' diff --git a/t/t3417-rebase-whitespace-fix.sh b/t/t3417-rebase-whitespace-fix.sh index 1fb3e499b..e85cdc703 100755 --- a/t/t3417-rebase-whitespace-fix.sh +++ b/t/t3417-rebase-whitespace-fix.sh @@ -55,7 +55,7 @@ test_expect_success 'blank line at end of file; extend at end of file' ' git add file && git commit -m second && git rebase --whitespace=fix HEAD^^ && git diff --exit-code HEAD^:file expect-first && - test_cmp file expect-second + test_cmp expect-second file ' # prepare third revision of "file" @@ -82,7 +82,7 @@ test_expect_success 'two blanks line at end of file; extend at end of file' ' cp third file && git add file && git commit -m third && git rebase --whitespace=fix HEAD^^ && git diff --exit-code HEAD^:file expect-second && - test_cmp file expect-third + test_cmp expect-third file ' test_expect_success 'same, but do not remove trailing spaces' ' @@ -120,7 +120,7 @@ test_expect_success 'at beginning of file' ' done >> file && git commit -m more file && git rebase --whitespace=fix HEAD^^ && - test_cmp file expect-beginning + test_cmp expect-beginning file ' test_done diff --git a/t/t3702-add-edit.sh b/t/t3702-add-edit.sh index c6af7f82b..6c676645d 100755 --- a/t/t3702-add-edit.sh +++ b/t/t3702-add-edit.sh @@ -110,10 +110,10 @@ test_expect_success 'add -e' ' cp second-part file && git add -e && test_cmp second-part file && - test_cmp orig-patch expected-patch && + test_cmp expected-patch orig-patch && git diff --cached >actual && grep -v index actual >out && - test_cmp out expected + test_cmp expected out ' diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index 6450bc669..cd216655b 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -36,7 +36,7 @@ EOF test_expect_success 'parents of stash' ' test $(git rev-parse stash^) = $(git rev-parse HEAD) && git diff stash^2..stash > output && - test_cmp output expect + test_cmp expect output ' test_expect_success 'applying bogus stash does nothing' ' @@ -210,9 +210,9 @@ test_expect_success 'stash branch' ' test refs/heads/stashbranch = $(git symbolic-ref HEAD) && test $(git rev-parse HEAD) = $(git rev-parse master^) && git diff --cached > output && - test_cmp output expect && + test_cmp expect output && git diff > output && - test_cmp output expect1 && + test_cmp expect1 output && git add file && git commit -m alternate\ second && git diff master..stashbranch > output && @@ -710,7 +710,7 @@ test_expect_success 'stash where working directory contains "HEAD" file' ' git diff-index --cached --quiet HEAD && test "$(git rev-parse stash^)" = "$(git rev-parse HEAD)" && git diff stash^..stash > output && - test_cmp output expect + test_cmp expect output ' test_expect_success 'store called with invalid commit' ' diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh index 597b0637d..cc1c8a7bb 100755 --- a/t/t3905-stash-include-untracked.sh +++ b/t/t3905-stash-include-untracked.sh @@ -142,7 +142,7 @@ test_expect_success 'stash save --include-untracked removed files' ' rm -f file && git stash save --include-untracked && echo 1 > expect && - test_cmp file expect + test_cmp expect file ' rm -f expect diff --git a/t/t4025-hunk-header.sh b/t/t4025-hunk-header.sh index fa44e7886..35578f2bb 100755 --- a/t/t4025-hunk-header.sh +++ b/t/t4025-hunk-header.sh @@ -37,7 +37,7 @@ test_expect_success 'hunk header truncation with an overly long line' ' echo " A $N$N$N$N$N$N$N$N$N2" && echo " L $N$N$N$N$N$N$N$N$N1" ) >expected && - test_cmp actual expected + test_cmp expected actual ' diff --git a/t/t4117-apply-reject.sh b/t/t4117-apply-reject.sh index d80187de9..f7de6f077 100755 --- a/t/t4117-apply-reject.sh +++ b/t/t4117-apply-reject.sh @@ -72,7 +72,7 @@ test_expect_success 'apply with --reject should fail but update the file' ' rm -f file1.rej file2.rej && test_must_fail git apply --reject patch.1 && - test_cmp file1 expected && + test_cmp expected file1 && cat file1.rej && test_path_is_missing file2.rej @@ -85,7 +85,7 @@ test_expect_success 'apply with --reject should fail but update the file' ' test_must_fail git apply --reject patch.2 >rejects && test_path_is_missing file1 && - test_cmp file2 expected && + test_cmp expected file2 && cat file2.rej && test_path_is_missing file1.rej @@ -99,7 +99,7 @@ test_expect_success 'the same test with --verbose' ' test_must_fail git apply --reject --verbose patch.2 >rejects && test_path_is_missing file1 && - test_cmp file2 expected && + test_cmp expected file2 && cat file2.rej && test_path_is_missing file1.rej diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh index 7e32237a2..ff51e9e78 100755 --- a/t/t4124-apply-ws-rule.sh +++ b/t/t4124-apply-ws-rule.sh @@ -313,9 +313,9 @@ test_expect_success 'applying beyond EOF requires one non-blank context line' ' { echo a; echo; } >one && cp one expect && test_must_fail git apply --whitespace=fix patch && - test_cmp one expect && + test_cmp expect one && test_must_fail git apply --ignore-space-change --whitespace=fix patch && - test_cmp one expect + test_cmp expect one ' test_expect_success 'tons of blanks at EOF should not apply' ' @@ -342,10 +342,10 @@ test_expect_success 'missing blank line at end with --whitespace=fix' ' cp one saved-one && test_must_fail git apply patch && git apply --whitespace=fix patch && - test_cmp one expect && + test_cmp expect one && mv saved-one one && git apply --ignore-space-change --whitespace=fix patch && - test_cmp one expect + test_cmp expect one ' test_expect_success 'two missing blank lines at end with --whitespace=fix' ' @@ -360,11 +360,11 @@ test_expect_success 'two missing blank lines at end with --whitespace=fix' ' cp no-blank-lines one && test_must_fail git apply patch && git apply --whitespace=fix patch && - test_cmp one expect && + test_cmp expect one && mv no-blank-lines one && test_must_fail git apply patch && git apply --ignore-space-change --whitespace=fix patch && - test_cmp one expect + test_cmp expect one ' test_expect_success 'missing blank line at end, insert before end, --whitespace=fix' ' @@ -376,7 +376,7 @@ test_expect_success 'missing blank line at end, insert before end, --whitespace= echo a >one && test_must_fail git apply patch && git apply --whitespace=fix patch && - test_cmp one expect + test_cmp expect one ' test_expect_success 'shrink file with tons of missing blanks at end of file' ' @@ -392,10 +392,10 @@ test_expect_success 'shrink file with tons of missing blanks at end of file' ' cp no-blank-lines one && test_must_fail git apply patch && git apply --whitespace=fix patch && - test_cmp one expect && + test_cmp expect one && mv no-blank-lines one && git apply --ignore-space-change --whitespace=fix patch && - test_cmp one expect + test_cmp expect one ' test_expect_success 'missing blanks at EOF must only match blank lines' ' @@ -427,7 +427,7 @@ test_expect_success 'missing blank line should match context line with spaces' ' git add one && git apply --whitespace=fix patch && - test_cmp one expect + test_cmp expect one ' sed -e's/Z//' >one <.gitattributes && git apply patch && - test_cmp one expect + test_cmp expect one ' test_expect_success 'CR-LF line endings && change line && text=auto' ' @@ -491,7 +491,7 @@ test_expect_success 'CR-LF line endings && change line && text=auto' ' mv save-one one && echo "one text=auto" >.gitattributes && git apply patch && - test_cmp one expect + test_cmp expect one ' test_expect_success 'LF in repo, CRLF in worktree && change line && text=auto' ' @@ -503,7 +503,7 @@ test_expect_success 'LF in repo, CRLF in worktree && change line && text=auto' ' echo "one text=auto" >.gitattributes && git -c core.eol=CRLF apply patch && printf "b\r\n" >expect && - test_cmp one expect + test_cmp expect one ' test_expect_success 'whitespace=fix to expand' ' diff --git a/t/t4138-apply-ws-expansion.sh b/t/t4138-apply-ws-expansion.sh index 0ffe33fbe..3b636a63a 100755 --- a/t/t4138-apply-ws-expansion.sh +++ b/t/t4138-apply-ws-expansion.sh @@ -114,7 +114,7 @@ for t in 1 2 3 4 do test_expect_success 'apply with ws expansion (t=$t)' ' git apply patch$t.patch && - test_cmp test-$t expect-$t + test_cmp expect-$t test-$t ' done diff --git a/t/t5317-pack-objects-filter-objects.sh b/t/t5317-pack-objects-filter-objects.sh index ce69148ec..c093eb891 100755 --- a/t/t5317-pack-objects-filter-objects.sh +++ b/t/t5317-pack-objects-filter-objects.sh @@ -34,7 +34,7 @@ test_expect_success 'verify blob count in normal packfile' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify blob:none packfile has no blobs' ' @@ -63,7 +63,7 @@ test_expect_success 'verify normal and blob:none packfiles have same commits/tre awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' # Test blob:limit=[kmg] filter. @@ -96,7 +96,7 @@ test_expect_success 'verify blob count in normal packfile' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify blob:limit=500 omits all blobs' ' @@ -144,7 +144,7 @@ test_expect_success 'verify blob:limit=1001' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify blob:limit=10001' ' @@ -162,7 +162,7 @@ test_expect_success 'verify blob:limit=10001' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify blob:limit=1k' ' @@ -180,7 +180,7 @@ test_expect_success 'verify blob:limit=1k' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify explicitly specifying oversized blob in input' ' @@ -199,7 +199,7 @@ test_expect_success 'verify explicitly specifying oversized blob in input' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify blob:limit=1m' ' @@ -217,7 +217,7 @@ test_expect_success 'verify blob:limit=1m' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify normal and blob:limit packfiles have same commits/trees' ' @@ -231,7 +231,7 @@ test_expect_success 'verify normal and blob:limit packfiles have same commits/tr awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' # Test sparse:path= filter. @@ -269,7 +269,7 @@ test_expect_success 'verify blob count in normal packfile' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify sparse:path=pattern1' ' @@ -287,7 +287,7 @@ test_expect_success 'verify sparse:path=pattern1' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify normal and sparse:path=pattern1 packfiles have same commits/trees' ' @@ -301,7 +301,7 @@ test_expect_success 'verify normal and sparse:path=pattern1 packfiles have same awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify sparse:path=pattern2' ' @@ -319,7 +319,7 @@ test_expect_success 'verify sparse:path=pattern2' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify normal and sparse:path=pattern2 packfiles have same commits/trees' ' @@ -333,7 +333,7 @@ test_expect_success 'verify normal and sparse:path=pattern2 packfiles have same awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' # Test sparse:oid= filter. @@ -370,7 +370,7 @@ test_expect_success 'verify blob count in normal packfile' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify sparse:oid=OID' ' @@ -389,7 +389,7 @@ test_expect_success 'verify sparse:oid=OID' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify sparse:oid=oid-ish' ' @@ -407,7 +407,7 @@ test_expect_success 'verify sparse:oid=oid-ish' ' awk -f print_1.awk | sort >observed && - test_cmp observed expected + test_cmp expected observed ' # Delete some loose objects and use pack-objects, but WITHOUT any filtering. diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh index 0c500f7ca..d6da3ce4e 100755 --- a/t/t5318-commit-graph.sh +++ b/t/t5318-commit-graph.sh @@ -35,7 +35,7 @@ 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 - test_cmp output expect + test_cmp expect output } graph_git_behavior() { diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh index 75ec79e6c..bf139e245 100755 --- a/t/t5701-git-serve.sh +++ b/t/t5701-git-serve.sh @@ -16,7 +16,7 @@ test_expect_success 'test capability advertisement' ' git serve --advertise-capabilities >out && test-pkt-line unpack actual && - test_cmp actual expect + test_cmp expect actual ' test_expect_success 'stateless-rpc flag does not list capabilities' ' @@ -89,7 +89,7 @@ test_expect_success 'basics of ls-refs' ' git serve --stateless-rpc out && test-pkt-line unpack actual && - test_cmp actual expect + test_cmp expect actual ' test_expect_success 'basic ref-prefixes' ' @@ -109,7 +109,7 @@ test_expect_success 'basic ref-prefixes' ' git serve --stateless-rpc out && test-pkt-line unpack actual && - test_cmp actual expect + test_cmp expect actual ' test_expect_success 'refs/heads prefix' ' @@ -129,7 +129,7 @@ test_expect_success 'refs/heads prefix' ' git serve --stateless-rpc out && test-pkt-line unpack actual && - test_cmp actual expect + test_cmp expect actual ' test_expect_success 'peel parameter' ' @@ -150,7 +150,7 @@ test_expect_success 'peel parameter' ' git serve --stateless-rpc out && test-pkt-line unpack actual && - test_cmp actual expect + test_cmp expect actual ' test_expect_success 'symrefs parameter' ' @@ -171,7 +171,7 @@ test_expect_success 'symrefs parameter' ' git serve --stateless-rpc out && test-pkt-line unpack actual && - test_cmp actual expect + test_cmp expect actual ' test_expect_success 'sending server-options' ' @@ -191,7 +191,7 @@ test_expect_success 'sending server-options' ' git serve --stateless-rpc out && test-pkt-line unpack actual && - test_cmp actual expect + test_cmp expect actual ' test_expect_success 'unexpected lines are not allowed in fetch request' ' diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh index 3beeed454..54727450b 100755 --- a/t/t5702-protocol-v2.sh +++ b/t/t5702-protocol-v2.sh @@ -29,7 +29,7 @@ test_expect_success 'list refs with git:// using protocol v2' ' grep "git< version 2" log && git ls-remote --symref "$GIT_DAEMON_URL/parent" >expect && - test_cmp actual expect + test_cmp expect actual ' test_expect_success 'ref advertisment is filtered with ls-remote using protocol v2' ' @@ -42,7 +42,7 @@ test_expect_success 'ref advertisment is filtered with ls-remote using protocol $(git -C "$daemon_parent" rev-parse refs/heads/master)$(printf "\t")refs/heads/master EOF - test_cmp actual expect + test_cmp expect actual ' test_expect_success 'clone with git:// using protocol v2' ' @@ -138,7 +138,7 @@ test_expect_success 'list refs with file:// using protocol v2' ' grep "git< version 2" log && git ls-remote --symref "file://$(pwd)/file_parent" >expect && - test_cmp actual expect + test_cmp expect actual ' test_expect_success 'ref advertisment is filtered with ls-remote using protocol v2' ' @@ -151,7 +151,7 @@ test_expect_success 'ref advertisment is filtered with ls-remote using protocol $(git -C file_parent rev-parse refs/heads/master)$(printf "\t")refs/heads/master EOF - test_cmp actual expect + test_cmp expect actual ' test_expect_success 'server-options are sent when using ls-remote' ' @@ -164,7 +164,7 @@ test_expect_success 'server-options are sent when using ls-remote' ' $(git -C file_parent rev-parse refs/heads/master)$(printf "\t")refs/heads/master EOF - test_cmp actual expect && + test_cmp expect actual && grep "server-option=hello" log && grep "server-option=world" log ' diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh index 20aee43f9..51ee887a7 100755 --- a/t/t6023-merge-file.sh +++ b/t/t6023-merge-file.sh @@ -99,7 +99,7 @@ EOF printf "propter nomen suum." >> expect.txt test_expect_success "merge does not add LF away of change" \ - "test_cmp test3.txt expect.txt" + "test_cmp expect.txt test3.txt" cp test.txt backup.txt test_expect_success "merge with conflicts" \ @@ -122,7 +122,7 @@ non timebo mala, quoniam tu mecum es: virga tua et baculus tuus ipsa me consolata sunt. EOF -test_expect_success "expected conflict markers" "test_cmp test.txt expect.txt" +test_expect_success "expected conflict markers" "test_cmp expect.txt test.txt" cp backup.txt test.txt @@ -138,7 +138,7 @@ non timebo mala, quoniam tu mecum es: virga tua et baculus tuus ipsa me consolata sunt. EOF test_expect_success "merge conflicting with --ours" \ - "git merge-file --ours test.txt orig.txt new3.txt && test_cmp test.txt expect.txt" + "git merge-file --ours test.txt orig.txt new3.txt && test_cmp expect.txt test.txt" cp backup.txt test.txt cat > expect.txt << EOF @@ -154,7 +154,7 @@ non timebo mala, quoniam tu mecum es: virga tua et baculus tuus ipsa me consolata sunt. EOF test_expect_success "merge conflicting with --theirs" \ - "git merge-file --theirs test.txt orig.txt new3.txt && test_cmp test.txt expect.txt" + "git merge-file --theirs test.txt orig.txt new3.txt && test_cmp expect.txt test.txt" cp backup.txt test.txt cat > expect.txt << EOF @@ -171,7 +171,7 @@ non timebo mala, quoniam tu mecum es: virga tua et baculus tuus ipsa me consolata sunt. EOF test_expect_success "merge conflicting with --union" \ - "git merge-file --union test.txt orig.txt new3.txt && test_cmp test.txt expect.txt" + "git merge-file --union test.txt orig.txt new3.txt && test_cmp expect.txt test.txt" cp backup.txt test.txt test_expect_success "merge with conflicts, using -L" \ @@ -195,7 +195,7 @@ virga tua et baculus tuus ipsa me consolata sunt. EOF test_expect_success "expected conflict markers, with -L" \ - "test_cmp test.txt expect.txt" + "test_cmp expect.txt test.txt" sed "s/ tu / TU /" < new1.txt > new5.txt test_expect_success "conflict in removed tail" \ diff --git a/t/t6027-merge-binary.sh b/t/t6027-merge-binary.sh index 07735410b..4e6c7cb77 100755 --- a/t/t6027-merge-binary.sh +++ b/t/t6027-merge-binary.sh @@ -45,7 +45,7 @@ test_expect_success resolve ' false else git ls-files -s >current - test_cmp current expect + test_cmp expect current fi ' @@ -60,7 +60,7 @@ test_expect_success recursive ' false else git ls-files -s >current - test_cmp current expect + test_cmp expect current fi ' diff --git a/t/t6031-merge-filemode.sh b/t/t6031-merge-filemode.sh index 7d06461f1..87741efad 100755 --- a/t/t6031-merge-filemode.sh +++ b/t/t6031-merge-filemode.sh @@ -61,7 +61,7 @@ do_both_modes () { git checkout -f a2 && test_must_fail git merge -s $strategy b2 && git ls-files -u >actual && - test_cmp actual expect && + test_cmp expect actual && git ls-files -s file2 | grep ^100755 ' diff --git a/t/t6112-rev-list-filters-objects.sh b/t/t6112-rev-list-filters-objects.sh index 0f6b569e1..ae4402226 100755 --- a/t/t6112-rev-list-filters-objects.sh +++ b/t/t6112-rev-list-filters-objects.sh @@ -29,7 +29,7 @@ test_expect_success 'verify blob:none omits all 5 blobs' ' sed "s/~//" | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify emitted+omitted == all' ' @@ -42,7 +42,7 @@ test_expect_success 'verify emitted+omitted == all' ' sed "s/~//" | sort >observed && - test_cmp observed expected + test_cmp expected observed ' @@ -71,7 +71,7 @@ test_expect_success 'verify blob:limit=500 omits all blobs' ' sed "s/~//" | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify emitted+omitted == all' ' @@ -84,7 +84,7 @@ test_expect_success 'verify emitted+omitted == all' ' sed "s/~//" | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify blob:limit=1000' ' @@ -97,7 +97,7 @@ test_expect_success 'verify blob:limit=1000' ' sed "s/~//" | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify blob:limit=1001' ' @@ -110,7 +110,7 @@ test_expect_success 'verify blob:limit=1001' ' sed "s/~//" | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify blob:limit=1k' ' @@ -123,7 +123,7 @@ test_expect_success 'verify blob:limit=1k' ' sed "s/~//" | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify blob:limit=1m' ' @@ -165,7 +165,7 @@ test_expect_success 'verify sparse:path=pattern1 omits top-level files' ' sed "s/~//" | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify sparse:path=pattern2 omits both sparse2 files' ' @@ -178,7 +178,7 @@ test_expect_success 'verify sparse:path=pattern2 omits both sparse2 files' ' sed "s/~//" | sort >observed && - test_cmp observed expected + test_cmp expected observed ' # Test sparse:oid= filter. @@ -203,7 +203,7 @@ test_expect_success 'verify sparse:oid=OID omits top-level files' ' sed "s/~//" | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'verify sparse:oid=oid-ish omits top-level files' ' @@ -216,7 +216,7 @@ test_expect_success 'verify sparse:oid=oid-ish omits top-level files' ' sed "s/~//" | sort >observed && - test_cmp observed expected + test_cmp expected observed ' # Delete some loose objects and use rev-list, but WITHOUT any filtering. @@ -237,7 +237,7 @@ test_expect_success 'rev-list W/ --missing=print' ' sed "s/?//" | sort >observed && - test_cmp observed expected + test_cmp expected observed ' test_expect_success 'rev-list W/O --missing fails' ' diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 324933acf..826987ca8 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -160,7 +160,7 @@ test_expect_success 'checkout -m with merge conflict' ' git diff master:one :3:uno | sed -e "1,/^@@/d" -e "/^ /d" -e "s/^-/d/" -e "s/^+/a/" >current && fill d2 aT d7 aS >expect && - test_cmp current expect && + test_cmp expect current && git diff --cached two >current && test_must_be_empty current ' @@ -174,7 +174,7 @@ test_expect_success 'format of merge conflict from checkout -m' ' git ls-files >current && fill same two two two >expect && - test_cmp current expect && + test_cmp expect current && cat <<-EOF >expect && <<<<<<< simple diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index 10dc91620..e87164aa8 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@ -789,7 +789,7 @@ test_expect_success 'submodule add places git-dir in superprojects git-dir' ' (cd .git/modules/deeper/submodule && git log > ../../../../actual ) && - test_cmp actual expected + test_cmp expected actual ) ' @@ -807,7 +807,7 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir' ' (cd .git/modules/deeper/submodule && git log > ../../../../actual ) && - test_cmp actual expected + test_cmp expected actual ) ' @@ -827,7 +827,7 @@ test_expect_success 'submodule add places git-dir in superprojects git-dir recur git add deeper/submodule && git commit -m "update submodule" && git push origin : && - test_cmp actual expected + test_cmp expected actual ) ' @@ -874,7 +874,7 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir re (cd .git/modules/submodule/modules/subsubmodule && git log > ../../../../../actual ) && - test_cmp actual expected + test_cmp expected actual ) ' diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh index 668bbee73..562bd215a 100755 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@ -557,7 +557,7 @@ test_expect_success SYMLINKS 'difftool --dir-diff --symlink without unstaged cha EOF git difftool --dir-diff --symlink \ --extcmd "./.git/CHECK_SYMLINKS" branch HEAD && - test_cmp actual expect + test_cmp expect actual ' write_script modify-right-file <<\EOF diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh index 9af607884..2c309a57d 100755 --- a/t/t9100-git-svn-basic.sh +++ b/t/t9100-git-svn-basic.sh @@ -221,7 +221,7 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4 EOF -test_expect_success POSIXPERM,SYMLINKS "$name" "test_cmp a expected" +test_expect_success POSIXPERM,SYMLINKS "$name" "test_cmp expected a" test_expect_success 'exit if remote refs are ambigious' ' git config --add svn-remote.svn.fetch \ diff --git a/t/t9133-git-svn-nested-git-repo.sh b/t/t9133-git-svn-nested-git-repo.sh index f3c30e63b..f89486086 100755 --- a/t/t9133-git-svn-nested-git-repo.sh +++ b/t/t9133-git-svn-nested-git-repo.sh @@ -45,7 +45,7 @@ test_expect_success 'update git svn-cloned repo' ' git svn rebase && echo a > expect && echo b >> expect && - test_cmp a expect && + test_cmp expect a && rm expect ) ' @@ -69,7 +69,7 @@ test_expect_success 'update git svn-cloned repo' ' git svn rebase && echo a > expect && echo b >> expect && - test_cmp a expect && + test_cmp expect a && rm expect ) ' @@ -93,7 +93,7 @@ test_expect_success 'update git svn-cloned repo again' ' echo a > expect && echo b >> expect && echo c >> expect && - test_cmp a expect && + test_cmp expect a && rm expect ) ' diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh index 5dfee07d9..251fdd66c 100755 --- a/t/t9600-cvsimport.sh +++ b/t/t9600-cvsimport.sh @@ -148,7 +148,7 @@ test_expect_success PERL 'import from a CVS working tree' ' git cvsimport -a -z0 && echo 1 >expect && git log -1 --pretty=format:%s%n >actual && - test_cmp actual expect + test_cmp expect actual ) ' diff --git a/t/t9603-cvsimport-patchsets.sh b/t/t9603-cvsimport-patchsets.sh index c4c3c4954..3e64b11ea 100755 --- a/t/t9603-cvsimport-patchsets.sh +++ b/t/t9603-cvsimport-patchsets.sh @@ -29,11 +29,11 @@ test_expect_failure PERL 'import with criss cross times on revisions' ' Rev 3 Rev 2 Rev 1" > expect-master && - test_cmp actual-master expect-master && + test_cmp expect-master actual-master && echo "Rev 5 Branch A Wed Mar 11 19:09:10 2009 +0000 Rev 4 Branch A Wed Mar 11 19:03:52 2009 +0000" > expect-A && - test_cmp actual-A expect-A + test_cmp expect-A actual-A ' test_done diff --git a/t/t9604-cvsimport-timestamps.sh b/t/t9604-cvsimport-timestamps.sh index a4b3db24b..2ff4aa932 100755 --- a/t/t9604-cvsimport-timestamps.sh +++ b/t/t9604-cvsimport-timestamps.sh @@ -31,7 +31,7 @@ test_expect_success PERL 'check timestamps are UTC (TZ=CST6CDT)' ' Rev 2 2005-02-01 00:00:00 +0000 Rev 1 2005-01-01 00:00:00 +0000 EOF - test_cmp actual-1 expect-1 + test_cmp expect-1 actual-1 ' test_expect_success PERL 'check timestamps with author-specific timezones' ' @@ -65,7 +65,7 @@ test_expect_success PERL 'check timestamps with author-specific timezones' ' Rev 2 2005-01-31 18:00:00 -0600 User Two Rev 1 2005-01-01 00:00:00 +0000 User One EOF - test_cmp actual-2 expect-2 + test_cmp expect-2 actual-2 ' test_done From patchwork Mon Sep 17 22:24:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew DeVore X-Patchwork-Id: 10603517 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C1A8217D5 for ; Mon, 17 Sep 2018 22:25:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B625B2A2E6 for ; Mon, 17 Sep 2018 22:25:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA4712A78C; Mon, 17 Sep 2018 22:25:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60D372A2E6 for ; Mon, 17 Sep 2018 22:25:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728674AbeIRDy3 (ORCPT ); Mon, 17 Sep 2018 23:54:29 -0400 Received: from mail-pl1-f202.google.com ([209.85.214.202]:49865 "EHLO mail-pl1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728655AbeIRDy3 (ORCPT ); Mon, 17 Sep 2018 23:54:29 -0400 Received: by mail-pl1-f202.google.com with SMTP id b6-v6so8310618pls.16 for ; Mon, 17 Sep 2018 15:25:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=Tq+5eDyXTpqj2Y1KIL3XxtjpYr2WUJuF+yR07+VeAho=; b=BFQdiQENgBU+iNIq99q1IOWSYm94kZQf02FpGQ3OoW1RrkDMZFJP4t8jq9aTzkhR01 2A7dfk5OCGFY0amQpC8tLi+T+L7QpnwJLS7q9wTeFKCYMe5qzjxR09AWTWAzrg1AFex3 8Kaaora26rHOEQlVd2fJOj9gkMfMIUIecRLuNFMxAxLdxSCTBUeSTa7+an9JOeE3G5k6 9KCz27EybrMUkebQywubkSFvqECJv6mMxrJM4dcWXddArY2j9oLPFa/J5oLv5iZyICnc OyUASxLtbHTJCSMyDNZcbwPGZ1zKOFXskLwKDCKlxfv5d2p2+OqUihT2CmIryYkeSxQ+ dh6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Tq+5eDyXTpqj2Y1KIL3XxtjpYr2WUJuF+yR07+VeAho=; b=sbBZWoOEa2tRUDEd1SUz7z9yHbBHR8ls+MqJt3hsD44n/PcvIZDV+t7aqjDtt0NNLd HLI8Jc5HpyE/h45D7yPPklLN1MXt894lg4qLJoH9U6KyMRBf4Xqb/x91HdFfHJADfNSs bWPgHFXanlvN8R9wW1ewbFlaC8CBD976eacwZiJ/NZ4NmkNMWsVuLUVGwwwaB0DyQnbd b9VaRKtbnORQnNqlwIWUCypvgeS94x5/ZEa+I0daOF/4mBHGNl2EFsUZBhL5Le/H36OM us7dRYL0MHc9AlKLVY77YdqWTDHx7UhUgTFPPVbB534doA/0Sw/wtFan4KI+xEb0Sd6+ FU6Q== X-Gm-Message-State: APzg51AgFvEp5b36Ovb+2krpuffAoHBWIFMEpkfIS9AUEbBRTqKGRV+6 doZI6PcCjmecVGpDpaUZB+W5TQOsBIgg/0E5AP3li/H0BzYtDQkuyVWHCyejeTkVGJmcTCOqxaC R03LIb+RlQWINvfjPmIq3Sa/lCFJkKI+F3Yr3x1KJhFO7dSXOg/pd2i8Jjfo= X-Google-Smtp-Source: ANB0VdbL06Lt29besoR8bVEHpQj6+jSaHKd07VfPxVfkZfRpiPAkP4hw066+M31YDaTUL0Xt5Tr+B8Ppt9Hh X-Received: by 2002:a63:7b44:: with SMTP id k4-v6mr1225526pgn.77.1537223110403; Mon, 17 Sep 2018 15:25:10 -0700 (PDT) Date: Mon, 17 Sep 2018 15:24:21 -0700 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog Subject: [PATCH v2 4/6] tests: add linter check for pipe placement style From: Matthew DeVore To: git@vger.kernel.org Cc: Matthew DeVore , peff@peff.net, jonathantanmy@google.com, gitster@pobox.com, jrn@google.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP --- t/Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/t/Makefile b/t/Makefile index c83fd1886..4eceabbd5 100644 --- a/t/Makefile +++ b/t/Makefile @@ -78,7 +78,7 @@ check-chainlint: done && exit $$err test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \ - test-lint-filenames + test-lint-filenames test-lint-pipes test-lint-duplicates: @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \ @@ -101,6 +101,16 @@ test-lint-filenames: test -z "$$bad" || { \ echo >&2 "non-portable file name(s): $$bad"; exit 1; } +test-lint-pipes: + @# Do not use \ to join lines when the next line starts with a + @# pipe. Instead, end the prior line with the pipe, and allow that to + @# join the lines implicitly. + @bad="$$(${PERL_PATH} -n0e 'm/(\n[^\n|]+\\\n[\t ]+\|[^\n]*)/ and \ + print qq{$$ARGV:$$1\n\n}' $(T))"; \ + test -z "$$bad" || { \ + printf >&2 "pipe at start of line in file(s):\n%s\n" "$$bad"; \ + exit 1; } + aggregate-results-and-cleanup: $(T) $(MAKE) aggregate-results $(MAKE) clean From patchwork Mon Sep 17 22:24:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew DeVore X-Patchwork-Id: 10603521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25D6815A6 for ; Mon, 17 Sep 2018 22:25:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16BFD2A2E6 for ; Mon, 17 Sep 2018 22:25:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AA192A78C; Mon, 17 Sep 2018 22:25:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 740462A2E6 for ; Mon, 17 Sep 2018 22:25:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728677AbeIRDyd (ORCPT ); Mon, 17 Sep 2018 23:54:33 -0400 Received: from mail-ua1-f74.google.com ([209.85.222.74]:47986 "EHLO mail-ua1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728438AbeIRDyc (ORCPT ); Mon, 17 Sep 2018 23:54:32 -0400 Received: by mail-ua1-f74.google.com with SMTP id g19-v6so5904674uan.14 for ; Mon, 17 Sep 2018 15:25:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=qC8z1L993w1MevIk8Bgp+xXJHZ9u57pnwL0wgmtZq3A=; b=UicX1Yv/2x9ihBuPRXDPUqT5Pv3WeyyXnXIOqKcO54T8hvJcyOY5uDkWfGW1QphNR/ 0FJSeBz7vYQosC1+Qa5w3UoECb5gZaEpcctcRDBKZ8qfHiHWW5lg9PfYX8iANg4CUC1K dzhIZUY3p0JoIDS2czT8D6TQfdQxoQRPFe3NRTIaDvNtrsepn0hrFeA58foh/SnTWQys kl5r2guFvRjDRsUDyG17nONPOGXAfCjjH9hkXvm1DSMQ0p9pYuAp4yFX3BpAMUjsKdms YxbXvSWNbSWeJ2rfwk+2vgGK776L+XG9AmzBB1E5UZxnd3oil1Ts1Wc0rUi+RUionznx lJrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=qC8z1L993w1MevIk8Bgp+xXJHZ9u57pnwL0wgmtZq3A=; b=YxpQp1cvAJTs1ekOHyPvXksenZ6shD6pROMy1XVJ1szeL4k9qB0AsO1tlGNEoFXz4F 1v2+CItfboc6zeQmaDiwE/HUddlh0XfmNZvbIakkjbIi2ujUxtsw1W0KClkF7Mi0VwCN g6tLOD2e4BbLQaa+nuMYrSJvc/C0sOlxU1K6bReGCa8ETQ6TATWCwmntN+SE9ttEu7gY OTUo429CfjbX4vbaiVXejYxAF0YHwCSqTg0NjVDeuq2Fl/tePREzBMfH+wK1ORoMTrRE 4QiHvM/KlLUejC5ofx4q4jgaBpihk/GyNAGZHVlobOFWrZ+Kzlkazr9niMxDX0Y2uO7g J6hg== X-Gm-Message-State: APzg51Ahyd5S5leI6ccph+UfZzI0cubr24jag/PDn+97mgK/IW2ik2ZY 8IwiKdFMInzDkd5iPTuqgj4EtDlGzMVIwewffY3n6ElbCGxFfToJBjasyP7j2SqQRC1dq/XIIKt VXDe2tpoY2pbWnN+9ZpWcCSLwasLpUDvhYMObpux2Cw3iCxbDUTQsQcWp/S8= X-Google-Smtp-Source: ANB0VdY7Jh9wBWyYOfQpadD/QkMNX/ZrqFDi5zf+k0/RDCRyeIrvb9k7ZvCo5xzlYlUlOJ2qhnc0pVeLkbG4 X-Received: by 2002:a67:4d92:: with SMTP id i18-v6mr5634896vsg.49.1537223112808; Mon, 17 Sep 2018 15:25:12 -0700 (PDT) Date: Mon, 17 Sep 2018 15:24:22 -0700 In-Reply-To: Message-Id: <12cc68aabf76e08f6214b21df786e61301c8f55e.1537223021.git.matvore@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog Subject: [PATCH v2 5/6] tests: split up pipes From: Matthew DeVore To: git@vger.kernel.org Cc: Matthew DeVore , peff@peff.net, jonathantanmy@google.com, gitster@pobox.com, jrn@google.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some pipes in tests lose the exit code of git processes, which can mask unexpected behavior. Split these pipes up so that git commands are at the end of pipes rather than the beginning or middle. --- t/t5317-pack-objects-filter-objects.sh | 156 +++++++++++++------------ t/t5500-fetch-pack.sh | 6 +- t/t5616-partial-clone.sh | 14 ++- t/t6112-rev-list-filters-objects.sh | 103 ++++++++-------- t/t9101-git-svn-props.sh | 3 +- 5 files changed, 147 insertions(+), 135 deletions(-) diff --git a/t/t5317-pack-objects-filter-objects.sh b/t/t5317-pack-objects-filter-objects.sh index c093eb891..2e718f0bd 100755 --- a/t/t5317-pack-objects-filter-objects.sh +++ b/t/t5317-pack-objects-filter-objects.sh @@ -20,8 +20,9 @@ test_expect_success 'setup r1' ' ' test_expect_success 'verify blob count in normal packfile' ' - git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 | - awk -f print_2.awk | + git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \ + >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && git -C r1 pack-objects --rev --stdout >all.pack <<-EOF && @@ -29,8 +30,8 @@ test_expect_success 'verify blob count in normal packfile' ' EOF git -C r1 index-pack ../all.pack && - git -C r1 verify-pack -v ../all.pack | - grep blob | + git -C r1 verify-pack -v ../all.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -43,8 +44,8 @@ test_expect_success 'verify blob:none packfile has no blobs' ' EOF git -C r1 index-pack ../filter.pack && - git -C r1 verify-pack -v ../filter.pack | - grep blob | + git -C r1 verify-pack -v ../filter.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -53,13 +54,13 @@ test_expect_success 'verify blob:none packfile has no blobs' ' ' test_expect_success 'verify normal and blob:none packfiles have same commits/trees' ' - git -C r1 verify-pack -v ../all.pack | - grep -E "commit|tree" | + git -C r1 verify-pack -v ../all.pack >verify_result && + grep -E "commit|tree" verify_result | awk -f print_1.awk | sort >expected && - git -C r1 verify-pack -v ../filter.pack | - grep -E "commit|tree" | + git -C r1 verify-pack -v ../filter.pack >verify_result && + grep -E "commit|tree" verify_result | awk -f print_1.awk | sort >observed && @@ -82,8 +83,8 @@ test_expect_success 'setup r2' ' ' test_expect_success 'verify blob count in normal packfile' ' - git -C r2 ls-files -s large.1000 large.10000 | - awk -f print_2.awk | + git -C r2 ls-files -s large.1000 large.10000 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && git -C r2 pack-objects --rev --stdout >all.pack <<-EOF && @@ -91,8 +92,8 @@ test_expect_success 'verify blob count in normal packfile' ' EOF git -C r2 index-pack ../all.pack && - git -C r2 verify-pack -v ../all.pack | - grep blob | + git -C r2 verify-pack -v ../all.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -105,8 +106,8 @@ test_expect_success 'verify blob:limit=500 omits all blobs' ' EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack | - grep blob | + git -C r2 verify-pack -v ../filter.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -120,8 +121,8 @@ test_expect_success 'verify blob:limit=1000' ' EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack | - grep blob | + git -C r2 verify-pack -v ../filter.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -130,8 +131,8 @@ test_expect_success 'verify blob:limit=1000' ' ' test_expect_success 'verify blob:limit=1001' ' - git -C r2 ls-files -s large.1000 | - awk -f print_2.awk | + git -C r2 ls-files -s large.1000 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && git -C r2 pack-objects --rev --stdout --filter=blob:limit=1001 >filter.pack <<-EOF && @@ -139,8 +140,8 @@ test_expect_success 'verify blob:limit=1001' ' EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack | - grep blob | + git -C r2 verify-pack -v ../filter.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -148,8 +149,8 @@ test_expect_success 'verify blob:limit=1001' ' ' test_expect_success 'verify blob:limit=10001' ' - git -C r2 ls-files -s large.1000 large.10000 | - awk -f print_2.awk | + git -C r2 ls-files -s large.1000 large.10000 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && git -C r2 pack-objects --rev --stdout --filter=blob:limit=10001 >filter.pack <<-EOF && @@ -157,8 +158,8 @@ test_expect_success 'verify blob:limit=10001' ' EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack | - grep blob | + git -C r2 verify-pack -v ../filter.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -166,8 +167,8 @@ test_expect_success 'verify blob:limit=10001' ' ' test_expect_success 'verify blob:limit=1k' ' - git -C r2 ls-files -s large.1000 | - awk -f print_2.awk | + git -C r2 ls-files -s large.1000 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && git -C r2 pack-objects --rev --stdout --filter=blob:limit=1k >filter.pack <<-EOF && @@ -175,8 +176,8 @@ test_expect_success 'verify blob:limit=1k' ' EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack | - grep blob | + git -C r2 verify-pack -v ../filter.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -184,8 +185,8 @@ test_expect_success 'verify blob:limit=1k' ' ' test_expect_success 'verify explicitly specifying oversized blob in input' ' - git -C r2 ls-files -s large.1000 large.10000 | - awk -f print_2.awk | + git -C r2 ls-files -s large.1000 large.10000 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && git -C r2 pack-objects --rev --stdout --filter=blob:limit=1k >filter.pack <<-EOF && @@ -194,8 +195,8 @@ test_expect_success 'verify explicitly specifying oversized blob in input' ' EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack | - grep blob | + git -C r2 verify-pack -v ../filter.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -203,8 +204,8 @@ test_expect_success 'verify explicitly specifying oversized blob in input' ' ' test_expect_success 'verify blob:limit=1m' ' - git -C r2 ls-files -s large.1000 large.10000 | - awk -f print_2.awk | + git -C r2 ls-files -s large.1000 large.10000 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && git -C r2 pack-objects --rev --stdout --filter=blob:limit=1m >filter.pack <<-EOF && @@ -212,8 +213,8 @@ test_expect_success 'verify blob:limit=1m' ' EOF git -C r2 index-pack ../filter.pack && - git -C r2 verify-pack -v ../filter.pack | - grep blob | + git -C r2 verify-pack -v ../filter.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -221,13 +222,13 @@ test_expect_success 'verify blob:limit=1m' ' ' test_expect_success 'verify normal and blob:limit packfiles have same commits/trees' ' - git -C r2 verify-pack -v ../all.pack | - grep -E "commit|tree" | + git -C r2 verify-pack -v ../all.pack >verify_result && + grep -E "commit|tree" verify_result | awk -f print_1.awk | sort >expected && - git -C r2 verify-pack -v ../filter.pack | - grep -E "commit|tree" | + git -C r2 verify-pack -v ../filter.pack >verify_result && + grep -E "commit|tree" verify_result | awk -f print_1.awk | sort >observed && @@ -255,8 +256,9 @@ test_expect_success 'setup r3' ' ' test_expect_success 'verify blob count in normal packfile' ' - git -C r3 ls-files -s sparse1 sparse2 dir1/sparse1 dir1/sparse2 | - awk -f print_2.awk | + git -C r3 ls-files -s sparse1 sparse2 dir1/sparse1 dir1/sparse2 \ + >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && git -C r3 pack-objects --rev --stdout >all.pack <<-EOF && @@ -264,8 +266,8 @@ test_expect_success 'verify blob count in normal packfile' ' EOF git -C r3 index-pack ../all.pack && - git -C r3 verify-pack -v ../all.pack | - grep blob | + git -C r3 verify-pack -v ../all.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -273,8 +275,8 @@ test_expect_success 'verify blob count in normal packfile' ' ' test_expect_success 'verify sparse:path=pattern1' ' - git -C r3 ls-files -s dir1/sparse1 dir1/sparse2 | - awk -f print_2.awk | + git -C r3 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && git -C r3 pack-objects --rev --stdout --filter=sparse:path=../pattern1 >filter.pack <<-EOF && @@ -282,8 +284,8 @@ test_expect_success 'verify sparse:path=pattern1' ' EOF git -C r3 index-pack ../filter.pack && - git -C r3 verify-pack -v ../filter.pack | - grep blob | + git -C r3 verify-pack -v ../filter.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -291,13 +293,13 @@ test_expect_success 'verify sparse:path=pattern1' ' ' test_expect_success 'verify normal and sparse:path=pattern1 packfiles have same commits/trees' ' - git -C r3 verify-pack -v ../all.pack | - grep -E "commit|tree" | + git -C r3 verify-pack -v ../all.pack >verify_result && + grep -E "commit|tree" verify_result | awk -f print_1.awk | sort >expected && - git -C r3 verify-pack -v ../filter.pack | - grep -E "commit|tree" | + git -C r3 verify-pack -v ../filter.pack >verify_result && + grep -E "commit|tree" verify_result | awk -f print_1.awk | sort >observed && @@ -305,8 +307,8 @@ test_expect_success 'verify normal and sparse:path=pattern1 packfiles have same ' test_expect_success 'verify sparse:path=pattern2' ' - git -C r3 ls-files -s sparse1 dir1/sparse1 | - awk -f print_2.awk | + git -C r3 ls-files -s sparse1 dir1/sparse1 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && git -C r3 pack-objects --rev --stdout --filter=sparse:path=../pattern2 >filter.pack <<-EOF && @@ -314,8 +316,8 @@ test_expect_success 'verify sparse:path=pattern2' ' EOF git -C r3 index-pack ../filter.pack && - git -C r3 verify-pack -v ../filter.pack | - grep blob | + git -C r3 verify-pack -v ../filter.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -323,13 +325,13 @@ test_expect_success 'verify sparse:path=pattern2' ' ' test_expect_success 'verify normal and sparse:path=pattern2 packfiles have same commits/trees' ' - git -C r3 verify-pack -v ../all.pack | - grep -E "commit|tree" | + git -C r3 verify-pack -v ../all.pack >verify_result && + grep -E "commit|tree" verify_result | awk -f print_1.awk | sort >expected && - git -C r3 verify-pack -v ../filter.pack | - grep -E "commit|tree" | + git -C r3 verify-pack -v ../filter.pack >verify_result && + grep -E "commit|tree" verify_result | awk -f print_1.awk | sort >observed && @@ -356,8 +358,9 @@ test_expect_success 'setup r4' ' ' test_expect_success 'verify blob count in normal packfile' ' - git -C r4 ls-files -s pattern sparse1 sparse2 dir1/sparse1 dir1/sparse2 | - awk -f print_2.awk | + git -C r4 ls-files -s pattern sparse1 sparse2 dir1/sparse1 dir1/sparse2 \ + >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && git -C r4 pack-objects --rev --stdout >all.pack <<-EOF && @@ -365,8 +368,8 @@ test_expect_success 'verify blob count in normal packfile' ' EOF git -C r4 index-pack ../all.pack && - git -C r4 verify-pack -v ../all.pack | - grep blob | + git -C r4 verify-pack -v ../all.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -374,8 +377,8 @@ test_expect_success 'verify blob count in normal packfile' ' ' test_expect_success 'verify sparse:oid=OID' ' - git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 | - awk -f print_2.awk | + git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && oid=$(git -C r4 ls-files -s pattern | awk -f print_2.awk) && @@ -384,8 +387,8 @@ test_expect_success 'verify sparse:oid=OID' ' EOF git -C r4 index-pack ../filter.pack && - git -C r4 verify-pack -v ../filter.pack | - grep blob | + git -C r4 verify-pack -v ../filter.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -393,8 +396,8 @@ test_expect_success 'verify sparse:oid=OID' ' ' test_expect_success 'verify sparse:oid=oid-ish' ' - git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 | - awk -f print_2.awk | + git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && git -C r4 pack-objects --rev --stdout --filter=sparse:oid=master:pattern >filter.pack <<-EOF && @@ -402,8 +405,8 @@ test_expect_success 'verify sparse:oid=oid-ish' ' EOF git -C r4 index-pack ../filter.pack && - git -C r4 verify-pack -v ../filter.pack | - grep blob | + git -C r4 verify-pack -v ../filter.pack >verify_result && + grep blob verify_result | awk -f print_1.awk | sort >observed && @@ -414,8 +417,9 @@ test_expect_success 'verify sparse:oid=oid-ish' ' # This models previously omitted objects that we did not receive. test_expect_success 'setup r1 - delete loose blobs' ' - git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 | - awk -f print_2.awk | + git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \ + >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && for id in `cat expected | sed "s|..|&/|"` diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 5ac6f286d..086f2c40f 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -51,8 +51,10 @@ pull_to_client () { git update-ref refs/heads/B "$BTIP";; esac && - git symbolic-ref HEAD refs/heads/$(echo $heads | - sed -e "s/^\(.\).*$/\1/") && + git symbolic-ref HEAD refs/heads/$( + echo $heads | + sed -e "s/^\(.\).*$/\1/" + ) && git fsck --full && diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh index e4d032c9d..fc7aeb1ab 100755 --- a/t/t5616-partial-clone.sh +++ b/t/t5616-partial-clone.sh @@ -35,8 +35,8 @@ test_expect_success 'setup bare clone for server' ' test_expect_success 'do partial clone 1' ' git clone --no-checkout --filter=blob:none "file://$(pwd)/srv.bare" pc1 && - git -C pc1 rev-list HEAD --quiet --objects --missing=print | - awk -f print_1.awk | + git -C pc1 rev-list HEAD --quiet --objects --missing=print >revs && + awk -f print_1.awk revs | sed "s/?//" | sort >observed.oids && @@ -133,16 +133,18 @@ test_expect_success 'push new commits to server for file.3.txt' ' test_expect_success 'manual prefetch of missing objects' ' git -C pc1 fetch --filter=blob:none origin && - git -C pc1 rev-list master..origin/master --quiet --objects --missing=print | - awk -f print_1.awk | + git -C pc1 rev-list master..origin/master --quiet --objects --missing=print \ + >revs && + awk -f print_1.awk revs | sed "s/?//" | sort >observed.oids && test_line_count = 6 observed.oids && git -C pc1 fetch-pack --stdin "file://$(pwd)/srv.bare" revs && + awk -f print_1.awk revs | sed "s/?//" | sort >observed.oids && diff --git a/t/t6112-rev-list-filters-objects.sh b/t/t6112-rev-list-filters-objects.sh index ae4402226..b00cf6fa8 100755 --- a/t/t6112-rev-list-filters-objects.sh +++ b/t/t6112-rev-list-filters-objects.sh @@ -20,12 +20,13 @@ test_expect_success 'setup r1' ' ' test_expect_success 'verify blob:none omits all 5 blobs' ' - git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 | - awk -f print_2.awk | + git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \ + >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && - git -C r1 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:none | - awk -f print_1.awk | + git -C r1 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:none >revs && + awk -f print_1.awk revs | sed "s/~//" | sort >observed && @@ -33,12 +34,13 @@ test_expect_success 'verify blob:none omits all 5 blobs' ' ' test_expect_success 'verify emitted+omitted == all' ' - git -C r1 rev-list HEAD --objects | - awk -f print_1.awk | + git -C r1 rev-list HEAD --objects >revs && + awk -f print_1.awk revs | sort >expected && - git -C r1 rev-list HEAD --objects --filter-print-omitted --filter=blob:none | - awk -f print_1.awk | + git -C r1 rev-list HEAD --objects --filter-print-omitted --filter=blob:none \ + >revs && + awk -f print_1.awk revs | sed "s/~//" | sort >observed && @@ -62,12 +64,12 @@ test_expect_success 'setup r2' ' ' test_expect_success 'verify blob:limit=500 omits all blobs' ' - git -C r2 ls-files -s large.1000 large.10000 | - awk -f print_2.awk | + git -C r2 ls-files -s large.1000 large.10000 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && - git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=500 | - awk -f print_1.awk | + git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=500 >revs && + awk -f print_1.awk revs | sed "s/~//" | sort >observed && @@ -75,12 +77,12 @@ test_expect_success 'verify blob:limit=500 omits all blobs' ' ' test_expect_success 'verify emitted+omitted == all' ' - git -C r2 rev-list HEAD --objects | - awk -f print_1.awk | + git -C r2 rev-list HEAD --objects >revs && + awk -f print_1.awk revs | sort >expected && - git -C r2 rev-list HEAD --objects --filter-print-omitted --filter=blob:limit=500 | - awk -f print_1.awk | + git -C r2 rev-list HEAD --objects --filter-print-omitted --filter=blob:limit=500 >revs && + awk -f print_1.awk revs | sed "s/~//" | sort >observed && @@ -88,12 +90,12 @@ test_expect_success 'verify emitted+omitted == all' ' ' test_expect_success 'verify blob:limit=1000' ' - git -C r2 ls-files -s large.1000 large.10000 | - awk -f print_2.awk | + git -C r2 ls-files -s large.1000 large.10000 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && - git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1000 | - awk -f print_1.awk | + git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1000 >revs && + awk -f print_1.awk revs | sed "s/~//" | sort >observed && @@ -101,12 +103,12 @@ test_expect_success 'verify blob:limit=1000' ' ' test_expect_success 'verify blob:limit=1001' ' - git -C r2 ls-files -s large.10000 | - awk -f print_2.awk | + git -C r2 ls-files -s large.10000 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && - git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1001 | - awk -f print_1.awk | + git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1001 >revs && + awk -f print_1.awk revs | sed "s/~//" | sort >observed && @@ -114,12 +116,12 @@ test_expect_success 'verify blob:limit=1001' ' ' test_expect_success 'verify blob:limit=1k' ' - git -C r2 ls-files -s large.10000 | - awk -f print_2.awk | + git -C r2 ls-files -s large.10000 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && - git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1k | - awk -f print_1.awk | + git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1k >revs && + awk -f print_1.awk revs | sed "s/~//" | sort >observed && @@ -127,8 +129,8 @@ test_expect_success 'verify blob:limit=1k' ' ' test_expect_success 'verify blob:limit=1m' ' - git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1m | - awk -f print_1.awk | + git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1m >revs && + awk -f print_1.awk revs | sed "s/~//" | sort >observed && @@ -156,12 +158,12 @@ test_expect_success 'setup r3' ' ' test_expect_success 'verify sparse:path=pattern1 omits top-level files' ' - git -C r3 ls-files -s sparse1 sparse2 | - awk -f print_2.awk | + git -C r3 ls-files -s sparse1 sparse2 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && - git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:path=../pattern1 | - awk -f print_1.awk | + git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:path=../pattern1 >revs && + awk -f print_1.awk revs | sed "s/~//" | sort >observed && @@ -169,12 +171,12 @@ test_expect_success 'verify sparse:path=pattern1 omits top-level files' ' ' test_expect_success 'verify sparse:path=pattern2 omits both sparse2 files' ' - git -C r3 ls-files -s sparse2 dir1/sparse2 | - awk -f print_2.awk | + git -C r3 ls-files -s sparse2 dir1/sparse2 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && - git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:path=../pattern2 | - awk -f print_1.awk | + git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:path=../pattern2 >revs && + awk -f print_1.awk revs | sed "s/~//" | sort >observed && @@ -192,14 +194,14 @@ test_expect_success 'setup r3 part 2' ' ' test_expect_success 'verify sparse:oid=OID omits top-level files' ' - git -C r3 ls-files -s pattern sparse1 sparse2 | - awk -f print_2.awk | + git -C r3 ls-files -s pattern sparse1 sparse2 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && oid=$(git -C r3 ls-files -s pattern | awk -f print_2.awk) && - git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:oid=$oid | - awk -f print_1.awk | + git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:oid=$oid >revs && + awk -f print_1.awk revs | sed "s/~//" | sort >observed && @@ -207,12 +209,12 @@ test_expect_success 'verify sparse:oid=OID omits top-level files' ' ' test_expect_success 'verify sparse:oid=oid-ish omits top-level files' ' - git -C r3 ls-files -s pattern sparse1 sparse2 | - awk -f print_2.awk | + git -C r3 ls-files -s pattern sparse1 sparse2 >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && - git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:oid=master:pattern | - awk -f print_1.awk | + git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:oid=master:pattern >revs && + awk -f print_1.awk revs | sed "s/~//" | sort >observed && @@ -223,8 +225,9 @@ test_expect_success 'verify sparse:oid=oid-ish omits top-level files' ' # This models previously omitted objects that we did not receive. test_expect_success 'rev-list W/ --missing=print' ' - git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 | - awk -f print_2.awk | + git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \ + >ls_files_result && + awk -f print_2.awk ls_files_result | sort >expected && for id in `cat expected | sed "s|..|&/|"` @@ -232,8 +235,8 @@ test_expect_success 'rev-list W/ --missing=print' ' rm r1/.git/objects/$id done && - git -C r1 rev-list --quiet HEAD --missing=print --objects | - awk -f print_1.awk | + git -C r1 rev-list --quiet HEAD --missing=print --objects >revs && + awk -f print_1.awk revs | sed "s/?//" | sort >observed && diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh index 8a5c8dc1a..8cba331fc 100755 --- a/t/t9101-git-svn-props.sh +++ b/t/t9101-git-svn-props.sh @@ -174,7 +174,8 @@ test_expect_success 'test create-ignore' " cmp ./deeply/.gitignore create-ignore.expect && cmp ./deeply/nested/.gitignore create-ignore.expect && cmp ./deeply/nested/directory/.gitignore create-ignore.expect && - git ls-files -s | grep gitignore | cmp - create-ignore-index.expect + git ls-files -s >ls_files_result && + grep gitignore ls_files_result | cmp - create-ignore-index.expect " cat >prop.expect <<\EOF From patchwork Mon Sep 17 22:24:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew DeVore X-Patchwork-Id: 10603519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75E3C17D5 for ; Mon, 17 Sep 2018 22:25:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69B602A6AC for ; Mon, 17 Sep 2018 22:25:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E0B72A794; Mon, 17 Sep 2018 22:25:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 058892A6AC for ; Mon, 17 Sep 2018 22:25:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728682AbeIRDyd (ORCPT ); Mon, 17 Sep 2018 23:54:33 -0400 Received: from mail-pl1-f201.google.com ([209.85.214.201]:47375 "EHLO mail-pl1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728438AbeIRDyd (ORCPT ); Mon, 17 Sep 2018 23:54:33 -0400 Received: by mail-pl1-f201.google.com with SMTP id d40-v6so8324199pla.14 for ; Mon, 17 Sep 2018 15:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=WgK5LSuJhzNilwH/VUSjurYLUVWcGSsPrI2+29Jmvz4=; b=U9Y3rVBTwvkkjEBm+1ibF2vjFBtq/3lQpVQq6j2HlynmcbDd9/tRJ+iGqe8Xgvns5n DTvRQsxdorZLP8bY350c4K2v/f1G13TWebBcJKlmTUJw7C8s3dCx+CSI3NsQaYo0jxHd YK9if3B+6ZP3N4Atq1ykjS5JSChevVIFStWDSNj6+fKTSDGglNvIEWXDR+pqFpQBFuqj eKAsC5vzjzU+0Sd6MrTuCQ8S2wXwDGm0Qlz1yfJfCVu1arNBf/7raY0ONIIZIqrqLaV4 PAEwST33s9wGEDvpmUeUMut2Bf+sW+deIZ5Q8KvbSRUFsMFpj/uxHSFjCX7dMJa0TksR y0ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=WgK5LSuJhzNilwH/VUSjurYLUVWcGSsPrI2+29Jmvz4=; b=fnepvQlprqFgqVsNP7IdyZVPB11BsaBBEB1mwtltDm2ITIDRlTxYeb/uOZVkzGFmKh lnCvgqVuQnO//bn6QW7QPQyBa9VK5KJhEOUjxScjJdPW0lw5vUM3VdKmY1GCl4KZZRn/ Q+7Rg3x+hJHs5tDAodH9r3HNf/Vi5oHvrnjlVa1J1v383YErfwcJzgXWrzDePOtPfLrG P6l5oUlTA3R/kOK09gH68oA5TR5Tq+MWWb492bMKjUyVeWgtYR4L20y/UmnDkV76kUNN uy7TrMCsJC1N1kAWylG0kuizWqE+5xBa4WnkgplcJeFqQ6nJoKSuU365DWVcm/RK4oAl MpkA== X-Gm-Message-State: APzg51AbUsysMpPmjhBTQL4RzNxmhgpPPNMXMhMzbmM43VPqW1eyZbqf J+RwDmgksoB9i3FFcETCAV2rATKKAoF0sb3YAViUxrnR2ho6ywKEmQD78meDD/mPVCYApThamtz opST2PVQS11LhieshpSxKXyyck6Kug6c+511PEKV8vVhVrpqLyAP6h+jUfv8= X-Google-Smtp-Source: ANB0VdZFSBZ05saEKc1Ow90vGb3dh5IYgqG6QB3iV0gjJ5bHPs+UIsouDDD0S+W7ujTI/dIdg4Smz+jh+yKj X-Received: by 2002:a63:2a56:: with SMTP id q83-v6mr1081312pgq.12.1537223115016; Mon, 17 Sep 2018 15:25:15 -0700 (PDT) Date: Mon, 17 Sep 2018 15:24:23 -0700 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog Subject: [PATCH v2 6/6] t9109-git-svn-props.sh: split up several pipes From: Matthew DeVore To: git@vger.kernel.org Cc: Matthew DeVore , peff@peff.net, jonathantanmy@google.com, gitster@pobox.com, jrn@google.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A test uses several separate pipe sequences in a row which are awkward to split up. Wrap the split-up pipe in a function so the awkwardness is not repeated. Signed-off-by: Matthew DeVore Signed-off-by: Matthew DeVore --- t/t9101-git-svn-props.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh index 8cba331fc..952bd4814 100755 --- a/t/t9101-git-svn-props.sh +++ b/t/t9101-git-svn-props.sh @@ -190,16 +190,21 @@ EOF # This test can be improved: since all the svn:ignore contain the same # pattern, it can pass even though the propget did not execute on the # right directory. +# Note we avoid using pipes in order to ensure that git exits with 0. test_expect_success 'test propget' " - git svn propget svn:ignore . | cmp - prop.expect && + test_propget () { + git svn propget $1 $2 >observed + cmp - $3 + } && + test_propget svn:ignore . prop.expect && cd deeply && - git svn propget svn:ignore . | cmp - ../prop.expect && - git svn propget svn:entry:committed-rev nested/directory/.keep \ - | cmp - ../prop2.expect && - git svn propget svn:ignore .. | cmp - ../prop.expect && - git svn propget svn:ignore nested/ | cmp - ../prop.expect && - git svn propget svn:ignore ./nested | cmp - ../prop.expect && - git svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect + test_propget svn:ignore . ../prop.expect && + test_propget svn:entry:committed-rev nested/directory/.keep \ + ../prop2.expect && + test_propget svn:ignore .. ../prop.expect && + test_propget svn:ignore nested/ ../prop.expect && + test_propget svn:ignore ./nested ../prop.expect && + test_propget svn:ignore .././deeply/nested ../prop.expect " cat >prop.expect <<\EOF