From patchwork Fri Jun 28 22:59:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11023553 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 3068D138B for ; Fri, 28 Jun 2019 22:59:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48C5228834 for ; Fri, 28 Jun 2019 22:59:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CAF22888B; Fri, 28 Jun 2019 22:59:39 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 D42A228874 for ; Fri, 28 Jun 2019 22:59:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726879AbfF1W7i (ORCPT ); Fri, 28 Jun 2019 18:59:38 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:56292 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726863AbfF1W7h (ORCPT ); Fri, 28 Jun 2019 18:59:37 -0400 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:f01a:2fd6:a95e:5f84]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 11D39609C5; Fri, 28 Jun 2019 22:59:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1561762776; bh=u7JaaqB0a0zD6+4CoHGB2AgaV2yPYitcdG7sWCFWZqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=OmdSm51QAWz+OwXJlTcowmZwBRRva3c9hNNa2P6VrU8P0Yw1YVPgOmnIlAqAPi/H1 6tv0Rh1PIJE8tITADMDmQPZBstptTnHKTFldmmCEHJpSJBMU6QQwoP8xCvHz4k4EMS 4jKI63RKloreLvFA/u91qCPb9ZADKqGl38af7xsT4iYLill21UFATBlKHfCq8qexn3 6OFOKtpHOl/vsE/jRpuvDe9EnDf6eFQg9rzk0cM85yVQz0sZtgxxeRgHisGu4Ja+Qs I2Vi81m4mtrM6WCM+MulsG/XO7zs1ZgfAR3qZfBnaE9aQtSNHgj1ldZ4L8gdcCEbus i5EQqYd/ejIwjdpF2eS0q8YlBT6IhJwox2W3JTZKdWhd22tUG22ZV6Talz1VzWmHMZ Unxmm+5msq0Wh6NG+zG5FpsBhWSQjyhzJXD3EnVXXxhL/n9jzFOcdqVvwRziR47zTr tyayaXa/xuHS3RnSq6CcLaJ2NNZJPi6EpgFdeQg6vlCRcbw+ng3 From: "brian m. carlson" To: Cc: Jeff King , Duy Nguyen , Johannes Schindelin , Jonathan Tan , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 01/10] t: add helper to convert object IDs to paths Date: Fri, 28 Jun 2019 22:59:19 +0000 Message-Id: <20190628225928.622372-2-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.22.0.455.g172b71a6c5 In-Reply-To: <20190628225928.622372-1-sandals@crustytoothpaste.net> References: <20190628225928.622372-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There are several places in our testsuite where we want to insert a slash after an object ID to make it into a path we can reference under .git/objects, and we have various ways of doing so. Add a helper to provide a standard way of doing this that works for all size hashes. Signed-off-by: brian m. carlson --- t/test-lib-functions.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 0367cec5fd..7860491660 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1334,6 +1334,12 @@ test_oid () { eval "printf '%s' \"\${$var}\"" } +# Insert a slash into an object ID so it can be used to reference a location +# under ".git/objects". For example, "deadbeef..." becomes "de/adbeef..". +test_oid_to_path () { + echo "${1%${1#??}}/${1#??}" +} + # Choose a port number based on the test script's number and store it in # the given variable name, unless that variable already contains a number. test_set_port () { From patchwork Fri Jun 28 22:59:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11023559 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 40E8F746 for ; Fri, 28 Jun 2019 22:59:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D0FF28834 for ; Fri, 28 Jun 2019 22:59:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 512182887D; Fri, 28 Jun 2019 22:59:48 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 E627228834 for ; Fri, 28 Jun 2019 22:59:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726950AbfF1W7q (ORCPT ); Fri, 28 Jun 2019 18:59:46 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:56308 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726887AbfF1W7k (ORCPT ); Fri, 28 Jun 2019 18:59:40 -0400 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:f01a:2fd6:a95e:5f84]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 434DA60B16; Fri, 28 Jun 2019 22:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1561762777; bh=o+hxGFYz64vS5YwtrbB7b/CV3HWIJJVxh/QPX6mBBKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=fLEIyLrXD9lN28GhBs1JXXOFUdlpFh7TgnCx6y16oCf+EwCXiQIO9x/apXMK5JA+D Nej1WHuw5fW6zFmmVUXHeEEmD1Eo1MEC3eDiatCi4dRYA5pghYvIpouBcBmXQ9yrY7 dj/lzx7ZR0LGiMNwnfVmz6AMMpJfZZ+pu6sxpm80b3FifwfhR6XeFX0Uizi86XOWxm 0bcob4cZtWYicmT6trVAU7oAUD46yVfYWXakPV8XE/o+cioHHy30a0qDOSPeVPzaRg PuS2iFd73/4cugpzjVLHzFy2p1O523I3u4tES8RRLZs20Fq0VlN57kjMClI8FpWjKs o7nZovf9It+NgAtcE3ajKd+VLbSWqlGBEyBvmtzbUDvr56cUy0M7rh+GHAIttL7Jyq 3eqP0SM94WdLt1XHPe1O6AEeve9wn4Wb58Vx91ACDwZ66e5OqY2X7NCK03AYwpcvtw 0Owv1Hphz5ZitMJxGybujf40NI1qEmj/TDwJCec13Wl7IEwZVZL From: "brian m. carlson" To: Cc: Jeff King , Duy Nguyen , Johannes Schindelin , Jonathan Tan , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 02/10] t1410: make hash size independent Date: Fri, 28 Jun 2019 22:59:20 +0000 Message-Id: <20190628225928.622372-3-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.22.0.455.g172b71a6c5 In-Reply-To: <20190628225928.622372-1-sandals@crustytoothpaste.net> References: <20190628225928.622372-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 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 parsing object IDs using fixed-length shell patterns, use cut to extract the first two characters of an object ID in addition to the test helper for object paths. Update another test to look up an appropriate object ID fragment from the all-zeros object ID instead of hardcoding the value. Although the test for parsing reflogs at BUFSIZ boundaries passes, mark it with the SHA1 prerequisite, as it doesn't currently usefully test anything when using a hash longer than 20 bytes. Signed-off-by: brian m. carlson --- t/t1410-reflog.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index 79f731db37..82950c0282 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -30,14 +30,13 @@ check_fsck () { } corrupt () { - aa=${1%??????????????????????????????????????} zz=${1#??} - mv .git/objects/$aa/$zz .git/$aa$zz + mv .git/objects/$(test_oid_to_path $1) .git/$1 } recover () { - aa=${1%??????????????????????????????????????} zz=${1#??} + aa=$(echo $1 | cut -c 1-2) mkdir -p .git/objects/$aa - mv .git/$aa$zz .git/objects/$aa/$zz + mv .git/$1 .git/objects/$(test_oid_to_path $1) } check_dont_have () { @@ -55,6 +54,7 @@ check_dont_have () { } test_expect_success setup ' + test_oid_init && mkdir -p A/B && echo rat >C && echo ox >A/D && @@ -313,12 +313,12 @@ test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' ' # Each line is 114 characters, so we need 75 to still have a few before the # last 8K. The 89-character padding on the final entry lines up our # newline exactly. -test_expect_success 'parsing reverse reflogs at BUFSIZ boundaries' ' +test_expect_success SHA1 'parsing reverse reflogs at BUFSIZ boundaries' ' git checkout -b reflogskip && - z38=00000000000000000000000000000000000000 && + zf=$(test_oid zero_2) && ident="abc 0000000001 +0000" && for i in $(test_seq 1 75); do - printf "$z38%02d $z38%02d %s\t" $i $(($i+1)) "$ident" && + printf "$zf%02d $zf%02d %s\t" $i $(($i+1)) "$ident" && if test $i = 75; then for j in $(test_seq 1 89); do printf X @@ -329,7 +329,7 @@ test_expect_success 'parsing reverse reflogs at BUFSIZ boundaries' ' printf "\n" done >.git/logs/refs/heads/reflogskip && git rev-parse reflogskip@{73} >actual && - echo ${z38}03 >expect && + echo ${zf}03 >expect && test_cmp expect actual ' From patchwork Fri Jun 28 22:59:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11023555 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 5C7C9112C for ; Fri, 28 Jun 2019 22:59:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 762C328834 for ; Fri, 28 Jun 2019 22:59:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A3E82887D; Fri, 28 Jun 2019 22:59:44 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 4BF1E28834 for ; Fri, 28 Jun 2019 22:59:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726932AbfF1W7m (ORCPT ); Fri, 28 Jun 2019 18:59:42 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:56322 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726913AbfF1W7l (ORCPT ); Fri, 28 Jun 2019 18:59:41 -0400 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:f01a:2fd6:a95e:5f84]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id A0F9061008; Fri, 28 Jun 2019 22:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1561762780; bh=7lJMNO+gsrUtYNoF58wVY9SRsifBXhCjtnC7ymzrUwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=KmqKjrvKjDJG8llltDVc3o+DB/y47yWYoHVKMPwYeuYZ3EzI5c5HVf/G64ovoESPE LBJVKl0wAhIggYZAfH5zoErTeRjFAmwNG0GowJ0gYhSSPt1uh3Fcn4lzb85gbMhtD0 s+wzj4Laxw9cnZTXbNPrXEyje3Hbmo1+jOEsnefKjv2I4PqKWAxcvLCdQFBEan2g52 B1fgzvTBrrE/xpicnxSfpjGFDs8PhKgcM5Unqdr32s9NQil0iUYESwE4PypYYanpx7 Tn/g+7TsSK6hy5ai8NZnjU2ZTAdGVe5eS2EyDZOJpMRDX9V8m38IuESI8eqPVMwOCg d7AEPiUDrB+VfmtZi31K+GAwOjgb9vgVkkfWEiem9JhoF1WFGvb6uf6Nl/f3HuEGhg fgSPa8omUpj5mZBN8HOr58qVwKasOfAx2LeYD7jVYXLGXrzODrZm/xaD/RiWs1Kctn n1IllSuOf8qVX5GUDFzzvxybTSKrwOKtx+tVVNV295tjcWuESmP From: "brian m. carlson" To: Cc: Jeff King , Duy Nguyen , Johannes Schindelin , Jonathan Tan , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 03/10] t1450: make hash size independent Date: Fri, 28 Jun 2019 22:59:21 +0000 Message-Id: <20190628225928.622372-4-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.22.0.455.g172b71a6c5 In-Reply-To: <20190628225928.622372-1-sandals@crustytoothpaste.net> References: <20190628225928.622372-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace several hard-coded full and partial object IDs with variables or computed values. Create junk data to stuff inside an invalid tree that can be either 20 or 32 bytes long. Compute a binary all-zeros object ID instead of hard-coding a 20-byte length. Additionally, compute various object IDs by using test_oid and $EMPTY_BLOB so that this test works with multiple hash algorithms. Signed-off-by: brian m. carlson --- t/t1450-fsck.sh | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 0f268a3664..b36e0528d0 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -9,6 +9,7 @@ test_description='git fsck random collection of tests . ./test-lib.sh test_expect_success setup ' + test_oid_init && git config gc.auto 0 && git config i18n.commitencoding ISO-8859-1 && test_commit A fileA one && @@ -54,8 +55,8 @@ test_expect_success 'setup: helpers for corruption tests' ' test_expect_success 'object with bad sha1' ' sha=$(echo blob | git hash-object -w --stdin) && - old=$(echo $sha | sed "s+^..+&/+") && - new=$(dirname $old)/ffffffffffffffffffffffffffffffffffffff && + old=$(test_oid_to_path "$sha") && + new=$(dirname $old)/$(test_oid ff_2) && sha="$(dirname $new)$(basename $new)" && mv .git/objects/$old .git/objects/$new && test_when_finished "remove_object $sha" && @@ -84,7 +85,7 @@ test_expect_success 'branch pointing to non-commit' ' test_expect_success 'HEAD link pointing at a funny object' ' test_when_finished "mv .git/SAVED_HEAD .git/HEAD" && mv .git/HEAD .git/SAVED_HEAD && - echo 0000000000000000000000000000000000000000 >.git/HEAD && + echo $ZERO_OID >.git/HEAD && # avoid corrupt/broken HEAD from interfering with repo discovery test_must_fail env GIT_DIR=.git git fsck 2>out && cat out && @@ -244,10 +245,16 @@ test_expect_success 'tree object with duplicate entries' ' ' test_expect_success 'unparseable tree object' ' + test_oid_cache <<-\EOF && + junk sha1:twenty-bytes-of-junk + junk sha256:twenty-bytes-of-junk-twelve-more + EOF + test_when_finished "git update-ref -d refs/heads/wrong" && test_when_finished "remove_object \$tree_sha1" && test_when_finished "remove_object \$commit_sha1" && - tree_sha1=$(printf "100644 \0twenty-bytes-of-junk" | git hash-object -t tree --stdin -w --literally) && + junk=$(test_oid junk) && + tree_sha1=$(printf "100644 \0$junk" | git hash-object -t tree --stdin -w --literally) && commit_sha1=$(git commit-tree $tree_sha1) && git update-ref refs/heads/wrong $commit_sha1 && test_must_fail git fsck 2>out && @@ -275,8 +282,9 @@ test_expect_success 'tree entry with type mismatch' ' ' test_expect_success 'tag pointing to nonexistent' ' - cat >invalid-tag <<-\EOF && - object ffffffffffffffffffffffffffffffffffffffff + badoid=$(test_oid deadbeef) && + cat >invalid-tag <<-EOF && + object $badoid type commit tag invalid tagger T A Gger 1234567890 -0000 @@ -386,8 +394,8 @@ test_expect_success 'rev-list --verify-objects' ' test_expect_success 'rev-list --verify-objects with bad sha1' ' sha=$(echo blob | git hash-object -w --stdin) && - old=$(echo $sha | sed "s+^..+&/+") && - new=$(dirname $old)/ffffffffffffffffffffffffffffffffffffff && + old=$(test_oid_to_path $sha) && + new=$(dirname $old)/$(test_oid ff_2) && sha="$(dirname $new)$(basename $new)" && mv .git/objects/$old .git/objects/$new && test_when_finished "remove_object $sha" && @@ -402,7 +410,7 @@ test_expect_success 'rev-list --verify-objects with bad sha1' ' test_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out && cat out && - test_i18ngrep -q "error: hash mismatch 63ffffffffffffffffffffffffffffffffffffff" out + test_i18ngrep -q "error: hash mismatch $(dirname $new)$(test_oid ff_2)" out ' test_expect_success 'force fsck to ignore double author' ' @@ -417,13 +425,12 @@ test_expect_success 'force fsck to ignore double author' ' ' _bz='\0' -_bz5="$_bz$_bz$_bz$_bz$_bz" -_bz20="$_bz5$_bz5$_bz5$_bz5" +_bzoid=$(printf $ZERO_OID | sed -e 's/00/\\0/g') test_expect_success 'fsck notices blob entry pointing to null sha1' ' (git init null-blob && cd null-blob && - sha=$(printf "100644 file$_bz$_bz20" | + sha=$(printf "100644 file$_bz$_bzoid" | git hash-object -w --stdin -t tree) && git fsck 2>out && cat out && @@ -434,7 +441,7 @@ test_expect_success 'fsck notices blob entry pointing to null sha1' ' test_expect_success 'fsck notices submodule entry pointing to null sha1' ' (git init null-commit && cd null-commit && - sha=$(printf "160000 submodule$_bz$_bz20" | + sha=$(printf "160000 submodule$_bz$_bzoid" | git hash-object -w --stdin -t tree) && git fsck 2>out && cat out && @@ -586,7 +593,7 @@ test_expect_success 'fsck --connectivity-only' ' # its type. That lets us see that --connectivity-only is # not actually looking at the contents, but leaves it # free to examine the type if it chooses. - empty=.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 && + empty=.git/objects/$(test_oid_to_path $EMPTY_BLOB) && blob=$(echo unrelated | git hash-object -w --stdin) && mv -f $(sha1_file $blob) $empty && @@ -631,10 +638,12 @@ test_expect_success 'fsck --name-objects' ' test_expect_success 'alternate objects are correctly blamed' ' test_when_finished "rm -rf alt.git .git/objects/info/alternates" && + name=$(test_oid numeric) && + path=$(test_oid_to_path "$name") && git init --bare alt.git && echo "../../alt.git/objects" >.git/objects/info/alternates && - mkdir alt.git/objects/12 && - >alt.git/objects/12/34567890123456789012345678901234567890 && + mkdir alt.git/objects/$(dirname $path) && + >alt.git/objects/$(dirname $path)/$(basename $path) && test_must_fail git fsck >out 2>&1 && test_i18ngrep alt.git out ' From patchwork Fri Jun 28 22:59:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11023557 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 030B3746 for ; Fri, 28 Jun 2019 22:59:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E0B228834 for ; Fri, 28 Jun 2019 22:59:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11A462887D; Fri, 28 Jun 2019 22:59:47 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 B017C28834 for ; Fri, 28 Jun 2019 22:59:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726937AbfF1W7p (ORCPT ); Fri, 28 Jun 2019 18:59:45 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:56338 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726931AbfF1W7n (ORCPT ); Fri, 28 Jun 2019 18:59:43 -0400 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:f01a:2fd6:a95e:5f84]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 021466100A; Fri, 28 Jun 2019 22:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1561762781; bh=axlbtRUpZ5RiLIVlbfzPVAE+a73AC2bmKrWScyFgNEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=LrTEnV564SdvxIkTnrBOhpuVGCaUjmmhRCPZvPjfE+2uuXf6p1kWXtitUBGNn9e50 8Lway8pup8PjvCBNxowkXBD/75ykwtvXLKxC+nLab00ZBQnN/3R75RN6ZkkyZRh6jh skSKHC5gw4LEbzBGLOCMoisbENMxlb1e9T2RaZtLNr+PK+D1R90eCASj63n5TMfGgP 3j2ZdWD2P6O3kNJ7sSKcx3Lw/aaGBuZljQ8RCb71nGGLu6FUXUzttQxY0d4tLpPD05 fu6FTDb6hPGKADgsGzEIqEXJxdjNsBRlbp/Z0NFWg0BCWgGtBI6qYsuODuwpg2m3bk 7UNCDZbbST2Rhnx4zfYiKg5V85E7QV74f+NI/BoT0xRQ0eTxnTfBD5iVfnMPprcr6i IVZF4nCnT8ab2mc9nW422gwdvvmP3RTo9pWFQHc9xQH4o/z14SJ1dUhWqC0oTzVhUH +qV55lQfu+/nGWSipcKqEM5smCqTqJQ+EwY9YgsLgHg2YN1Pi3W From: "brian m. carlson" To: Cc: Jeff King , Duy Nguyen , Johannes Schindelin , Jonathan Tan , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 04/10] t5000: make hash independent Date: Fri, 28 Jun 2019 22:59:22 +0000 Message-Id: <20190628225928.622372-5-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.22.0.455.g172b71a6c5 In-Reply-To: <20190628225928.622372-1-sandals@crustytoothpaste.net> References: <20190628225928.622372-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This test uses a stub of a very large (64 GB) object to test our generation of tar archives. In doing so, it uses the object ID of the object so it can insert it into the database properly. Look up these values using test_oid. Restructure the test slightly to use test_oid_in_path. Since we care about the object, not how it is named in a particular hash algorithm, rename it to "huge-object", which is shorter and more descriptive. Signed-off-by: brian m. carlson --- t/t5000-tar-tree.sh | 16 +++++++++++----- ...5a8938e6999cb59b3ff66739902a => huge-object} | Bin 2 files changed, 11 insertions(+), 5 deletions(-) rename t/t5000/{19f9c8273ec45a8938e6999cb59b3ff66739902a => huge-object} (100%) diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index 602bfd9574..37655a237c 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -94,6 +94,13 @@ check_tar() { ' } +test_expect_success 'setup' ' + test_oid_cache <<-EOF + obj sha1:19f9c8273ec45a8938e6999cb59b3ff66739902a + obj sha256:3c666f798798601571f5cec0adb57ce4aba8546875e7693177e0535f34d2c49b + EOF +' + test_expect_success \ 'populate workdir' \ 'mkdir a && @@ -369,11 +376,10 @@ test_lazy_prereq TAR_HUGE ' ' test_expect_success LONG_IS_64BIT 'set up repository with huge blob' ' - obj_d=19 && - obj_f=f9c8273ec45a8938e6999cb59b3ff66739902a && - obj=${obj_d}${obj_f} && - mkdir -p .git/objects/$obj_d && - cp "$TEST_DIRECTORY"/t5000/$obj .git/objects/$obj_d/$obj_f && + obj=$(test_oid obj) && + path=$(test_oid_to_path $obj) && + mkdir -p .git/objects/$(dirname $path) && + cp "$TEST_DIRECTORY"/t5000/huge-object .git/objects/$path && rm -f .git/index && git update-index --add --cacheinfo 100644,$obj,huge && git commit -m huge diff --git a/t/t5000/19f9c8273ec45a8938e6999cb59b3ff66739902a b/t/t5000/huge-object similarity index 100% rename from t/t5000/19f9c8273ec45a8938e6999cb59b3ff66739902a rename to t/t5000/huge-object From patchwork Fri Jun 28 22:59:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11023561 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 4FE27746 for ; Fri, 28 Jun 2019 22:59:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69FCA28834 for ; Fri, 28 Jun 2019 22:59:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E0612887D; Fri, 28 Jun 2019 22:59: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 E59EE28834 for ; Fri, 28 Jun 2019 22:59:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbfF1W7q (ORCPT ); Fri, 28 Jun 2019 18:59:46 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:56348 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726913AbfF1W7o (ORCPT ); Fri, 28 Jun 2019 18:59:44 -0400 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:f01a:2fd6:a95e:5f84]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id F28E56100C; Fri, 28 Jun 2019 22:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1561762782; bh=UxwWHo2TSb3qE7r58BZQeSbub9Eke0heb/Wo8Q0Jj7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=XEqav1tDebh1MUm/we6qB1VyzEdhxKLgbE9sG1sb1e49viyVes2odV2EDDoYDgCKU Qmh6meknpGDGfSpNcovh9DsRHHLWbg2htDTHBTi4dXBbxTBMQSZ7OLEEq5IOLy9vM0 dE1/Lnmh3cuhBZoBYZN3eNBygHIbZsgR12XpKJMdpJvMd5wPSkX8QiZCnVvx3Hzc6p vusaoueVgDoWBpr5awIIBjs4p/HguBa/PswdiuFzsxvI7+oi4O/xQRHzMTpJEGL/8U GT4mJB0hhCuQu6hQmZjEtz4quND+KTHZZuq1ZQXoeT6fZMunfyNKQSsPMtKKCrG+fn 7bO8AoDr16cMEQMJJD/hp6BjxDYJLItrd6vmsp8TczC5QlkinFRhH/LGBPrSbp/xh6 tdavSwu5YfpYmoqVBhZLTExkYXDfWeaA6Buu/Lhj334iDU9j4Y8gfcfECRe7U2apTV EjqDdubxyp/YPFlomufvWipx9iqOjX4OI1U49EeMdjDiUm6ENzH From: "brian m. carlson" To: Cc: Jeff King , Duy Nguyen , Johannes Schindelin , Jonathan Tan , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 05/10] t6030: make test work with SHA-256 Date: Fri, 28 Jun 2019 22:59:23 +0000 Message-Id: <20190628225928.622372-6-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.22.0.455.g172b71a6c5 In-Reply-To: <20190628225928.622372-1-sandals@crustytoothpaste.net> References: <20190628225928.622372-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Compute several object ID values instead of hard-coding them, and use test_oid_to_path to cleanly produce a path for an object. Note that the bisect code which is tested here remains sensitive to the hash algorithm in use because it uses the object ID to disambiguate between two equidistant commits. Fortunately, SHA-1 and SHA-256 disambiguate identically in the cases we care about, so there is no need to modify the test to accommodate this situation. However, if a further hash algorithm change occurs, this test may require some restructuring. Signed-off-by: brian m. carlson --- t/t6030-bisect-porcelain.sh | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 49a394bd75..bdc42e9440 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -615,6 +615,7 @@ test_expect_success 'broken branch creation' ' git add missing/MISSING && git commit -m "6(broken): Added file that will be deleted" && git tag BROKEN_HASH6 && + deleted=$(git rev-parse --verify HEAD:missing) && add_line_into_file "7(broken): second line on a broken branch" hello2 && git tag BROKEN_HASH7 && add_line_into_file "8(broken): third line on a broken branch" hello2 && @@ -622,12 +623,12 @@ test_expect_success 'broken branch creation' ' git rm missing/MISSING && git commit -m "9(broken): Remove missing file" && git tag BROKEN_HASH9 && - rm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d + rm .git/objects/$(test_oid_to_path $deleted) ' echo "" > expected.ok cat > expected.missing-tree.default < expected.bisect-log < into . -# good: [7b7f204a749c3125d5224ed61ea2ae1187ad046f] Add <2: A new day for git> into . -git bisect start '32a594a3fdac2d57cf6d02987e30eec68511498c' '7b7f204a749c3125d5224ed61ea2ae1187ad046f' -# good: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into . -git bisect good 3de952f2416b6084f557ec417709eac740c6818c -# first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into . +# bad: [$HASH4] Add <4: Ciao for now> into . +# good: [$HASH2] Add <2: A new day for git> into . +git bisect start '$HASH4' '$HASH2' +# good: [$HASH3] Add <3: Another new day for git> into . +git bisect good $HASH3 +# first bad commit: [$HASH4] Add <4: Ciao for now> into . EOF test_expect_success 'bisect log: successful result' ' @@ -731,14 +732,14 @@ test_expect_success 'bisect log: successful result' ' ' cat > expected.bisect-skip-log < into . -# good: [7b7f204a749c3125d5224ed61ea2ae1187ad046f] Add <2: A new day for git> into . -git bisect start '32a594a3fdac2d57cf6d02987e30eec68511498c' '7b7f204a749c3125d5224ed61ea2ae1187ad046f' -# skip: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into . -git bisect skip 3de952f2416b6084f557ec417709eac740c6818c +# bad: [$HASH4] Add <4: Ciao for now> into . +# good: [$HASH2] Add <2: A new day for git> into . +git bisect start '$HASH4' '$HASH2' +# skip: [$HASH3] Add <3: Another new day for git> into . +git bisect skip $HASH3 # only skipped commits left to test -# possible first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into . -# possible first bad commit: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into . +# possible first bad commit: [$HASH4] Add <4: Ciao for now> into . +# possible first bad commit: [$HASH3] Add <3: Another new day for git> into . EOF test_expect_success 'bisect log: only skip commits left' ' From patchwork Fri Jun 28 22:59:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11023563 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 18868112C for ; Fri, 28 Jun 2019 22:59:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3448A28834 for ; Fri, 28 Jun 2019 22:59:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 284C12887D; Fri, 28 Jun 2019 22:59:50 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 C8ECC28834 for ; Fri, 28 Jun 2019 22:59:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726957AbfF1W7s (ORCPT ); Fri, 28 Jun 2019 18:59:48 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:56356 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726913AbfF1W7q (ORCPT ); Fri, 28 Jun 2019 18:59:46 -0400 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:f01a:2fd6:a95e:5f84]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 87C8B61017; Fri, 28 Jun 2019 22:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1561762784; bh=ws/Xhm5WN7RyZkcjH8yBrGszRMfK4DiJ2XCDXTGo2Gk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=AVQC6yqrW0A0FCa4RR9QYklTt8CNWs4bpKoToZ0L1sVcHbTyvXlPyTxw0p+nxi2D+ lfjgye4XDWir3Di59XPsluIQaSwsIEfgiP3Agc+2l1FmKM3IPR2qipR0toLCzIG1JP AN7T8G871dr4bE1c1ge9t8QuZcRMoPsQ4IIoWn4F8GpnaObBXgSH7FaWjbASlbSIkO 4fJXsmHslYg1I2wNryKBcqk204123XTw+EatPOLF3Iq8ARiR3V2+SlAVIWugCiib64 ayRJpjs+2ngnJnCdTXMn0GaOTh1tSYgYyaUWQo3YVA6hrUHuL+m4kU6QPVAhsQCFWm IgGzJuasLj8lScpqZnsRjg8L0D1H036fkOVN30KpgyKTXJUUA6LhyZ/rELDA8Cw5fF 9BNDn9V0tUawqG+1XdUQLNOe73tGemmDkg11YDEd5+H5rvyjDSfSsAZqBDLw2OYf0z lgaS2zBW5zf4Z+w7xKWUn0ZdmWNRN+hxZZa9IfnwwnV06jm+LX+ From: "brian m. carlson" To: Cc: Jeff King , Duy Nguyen , Johannes Schindelin , Jonathan Tan , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 06/10] t0027: make hash size independent Date: Fri, 28 Jun 2019 22:59:24 +0000 Message-Id: <20190628225928.622372-7-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.22.0.455.g172b71a6c5 In-Reply-To: <20190628225928.622372-1-sandals@crustytoothpaste.net> References: <20190628225928.622372-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Several parts of this test generate files that have specific hard-coded object IDs in them. We don't really care about what the object ID in question is, so we turn them all to zeros. However, because some of these values are fixed and some are generated, they can be of different lengths, which causes problems when running with SHA-256. Furthermore, some assertions in this test use only fixed object IDs and some use both fixed and generated ones, so converting only the expected results fixes some tests while breaking others. Convert both actual and expected object IDs to the all-zeros object ID of the appropriate length to ensure that the test passes when using SHA-256. The astute observer will notice that both tr and sed are used here. Converting the tr call to a sed y/// command looks logical at first, but it isn't possible because POSIX doesn't allow escapes in y/// commands other than "\\" and "\n". Signed-off-by: brian m. carlson --- t/t0027-auto-crlf.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh index 3587e454f1..959b6da449 100755 --- a/t/t0027-auto-crlf.sh +++ b/t/t0027-auto-crlf.sh @@ -15,8 +15,10 @@ compare_ws_file () { pfx=$1 exp=$2.expect act=$pfx.actual.$3 - tr '\015\000abcdef0123456789' QN00000000000000000 <"$2" >"$exp" && - tr '\015\000abcdef0123456789' QN00000000000000000 <"$3" >"$act" && + tr '\015\000abcdef0123456789' QN00000000000000000 <"$2" | + sed -e "s/0000*/$ZERO_OID/" >"$exp" && + tr '\015\000abcdef0123456789' QN00000000000000000 <"$3" | + sed -e "s/0000*/$ZERO_OID/" >"$act" && test_cmp "$exp" "$act" && rm "$exp" "$act" } From patchwork Fri Jun 28 22:59:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11023565 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 4A72D746 for ; Fri, 28 Jun 2019 22:59:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6690628834 for ; Fri, 28 Jun 2019 22:59:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A9B72887D; Fri, 28 Jun 2019 22:59:52 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 0A1A628834 for ; Fri, 28 Jun 2019 22:59:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726913AbfF1W7v (ORCPT ); Fri, 28 Jun 2019 18:59:51 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:56372 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726887AbfF1W7s (ORCPT ); Fri, 28 Jun 2019 18:59:48 -0400 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:f01a:2fd6:a95e:5f84]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 7C0566101B; Fri, 28 Jun 2019 22:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1561762787; bh=Phj/AHj6kyTS/Qy5e/n5OvwxT34sihB9KInmpPuA8ZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=YV1fLZoVPagbv+NuKBZXznpwwny2b+FXCz0Wg6qC69LSJitK5wfYKQI0+CkUEhTJG L1mekwtJ+HqAC3xpFj7ucM88NdSvqSBOKGXCXB71WzbFX5GKvMX3kldXEYrzhfpyVu x43LJMzlcck6H3bG//pUSayKvK9CNVE+Glqo4kc90z2ghohJCPFbHNgVGfNeHB8Y6D kqhHrGibazL1Lts9gChKzAo19Y127kMxLibucDbMKfds2jxdap2dF451ySqDtFOn7U Oq6ui7F9BpirXYBTHEsrK60r4ah4MVegVJPk8ks3vM84HAvjBW1+7VsTSaoARKvcEV UiqDr20at54kgkQBlQkKtfYdQCfpieIo4KvjSyt0yOVV5xrfcV5G6m4i5hQhPF/ogI n9jfghLk4NXeufNSa2B/1t32bfup0WYoLkLlYJcxQNeavoZL64Xt4K2krkn+K+nQy9 QT+dW7fveofAC2aSc12SWX6E6dmkpoH1pKN4ly2OWz4SxGdB2p0 From: "brian m. carlson" To: Cc: Jeff King , Duy Nguyen , Johannes Schindelin , Jonathan Tan , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 07/10] t0090: make test pass with SHA-256 Date: Fri, 28 Jun 2019 22:59:25 +0000 Message-Id: <20190628225928.622372-8-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.22.0.455.g172b71a6c5 In-Reply-To: <20190628225928.622372-1-sandals@crustytoothpaste.net> References: <20190628225928.622372-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP One assertion of this test checks for a shrinking cache tree. The initial index contains a cache tree with two directory names but no object ID, and the second index contains a cache tree with an object ID but no directory name. With SHA-1, the second index is smaller than the first, because the directory information stored takes more than the 20 bytes of an SHA-1 hash, but with SHA-256, the hash is longer, and the test fails the assertion that the second index is smaller than the first. To address this issue, increase the length of the subdirectory name to ensure that the cache tree does indeed shrink in size regardless of the algorithm in use. Signed-off-by: brian m. carlson --- t/t0090-cache-tree.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh index 504334e552..ce9a4a5f32 100755 --- a/t/t0090-cache-tree.sh +++ b/t/t0090-cache-tree.sh @@ -162,8 +162,8 @@ test_expect_success PERL 'commit --interactive gives cache-tree on partial commi ' test_expect_success PERL 'commit -p with shrinking cache-tree' ' - mkdir -p deep/subdir && - echo content >deep/subdir/file && + mkdir -p deep/very-long-subdir && + echo content >deep/very-long-subdir/file && git add deep && git commit -m add && git rm -r deep && From patchwork Fri Jun 28 22:59:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11023567 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 3A7EF746 for ; Fri, 28 Jun 2019 22:59:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 547E628834 for ; Fri, 28 Jun 2019 22:59:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4892F2887D; Fri, 28 Jun 2019 22:59:54 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 D0A4328874 for ; Fri, 28 Jun 2019 22:59:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726960AbfF1W7x (ORCPT ); Fri, 28 Jun 2019 18:59:53 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:56388 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726835AbfF1W7v (ORCPT ); Fri, 28 Jun 2019 18:59:51 -0400 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:f01a:2fd6:a95e:5f84]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 777456101D; Fri, 28 Jun 2019 22:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1561762788; bh=M0MQpkFrfaSOrgT/0PAL3clo9+uKbC69veH6kSfTa3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=n9xee+rXJTDsZk++7dBH7qJM21/fC59dvQ+uzYVtQdQTTACaIfg0MNRaYbkHshwwo ZZcoXJVzDOLbY3ZiC4DI9luwJow8u/7Nv0wKuwGHhdmjfrHzUOXVjA6VBsk8By4wFs HZnsT9gxieUEzZaJovraN8+L75SkCLsoY0v5mTVU+f7BwmCSi3nPa9/0kdE4bOQCli qRLyKWh6gYLd9DHwA7PfdfkGoMpguY5i+QzRTsWwy1AnHi/1bwRoUr9vWnba+i3Doe Z4AHNw2tR6Fj2e3uaW4RUNWX1/w8AjZlfzDFo8rI+vPqZiKafIWBU10iPSffwxuh+V jrSrlaej3CB+qbZKCjK7iDVeNrP1ZO4P6a6mvdNWLxlSZccFsgdnIitbBdI44rbBQs OUIAUM/+poVSs3bfD0268tM+r/ogc+rznURmnQFLnwjVm6WR42K5IOKezmI9eGylMK jKjwqm7MUv1Wtvs74j0QahzI8xuyCD/g4D41q9C5p6opGkNi8fN From: "brian m. carlson" To: Cc: Jeff King , Duy Nguyen , Johannes Schindelin , Jonathan Tan , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 08/10] t1007: remove SHA1 prerequisites Date: Fri, 28 Jun 2019 22:59:26 +0000 Message-Id: <20190628225928.622372-9-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.22.0.455.g172b71a6c5 In-Reply-To: <20190628225928.622372-1-sandals@crustytoothpaste.net> References: <20190628225928.622372-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Update this test to use test_oid_cache to specify the object IDs for both SHA-1 and SHA-256. Since this test now works with both algorithms, remove the SHA1 prerequisite. Signed-off-by: brian m. carlson --- t/t1007-hash-object.sh | 58 +++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh index 7099d33508..64b340f227 100755 --- a/t/t1007-hash-object.sh +++ b/t/t1007-hash-object.sh @@ -9,22 +9,19 @@ echo_without_newline() { } test_blob_does_not_exist() { - test_expect_success SHA1 'blob does not exist in database' " + test_expect_success 'blob does not exist in database' " test_must_fail git cat-file blob $1 " } test_blob_exists() { - test_expect_success SHA1 'blob exists in database' " + test_expect_success 'blob exists in database' " git cat-file blob $1 " } hello_content="Hello World" -hello_sha1=5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689 - example_content="This is an example" -example_sha1=ddd3f836d3e3fbb7ae289aa9ae83536f76956399 setup_repo() { echo_without_newline "$hello_content" > hello @@ -44,7 +41,16 @@ pop_repo() { rm -rf $test_repo } -setup_repo +test_expect_success 'setup' ' + setup_repo && + test_oid_cache <<-EOF + hello sha1:5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689 + hello sha256:1e3b6c04d2eeb2b3e45c8a330445404c0b7cc7b257e2b097167d26f5230090c4 + + example sha1:ddd3f836d3e3fbb7ae289aa9ae83536f76956399 + example sha256:b44fe1fe65589848253737db859bd490453510719d7424daab03daf0767b85ae + EOF +' # Argument checking @@ -73,23 +79,23 @@ test_expect_success "Can't use --path with --no-filters" ' push_repo -test_expect_success SHA1 'hash a file' ' - test $hello_sha1 = $(git hash-object hello) +test_expect_success 'hash a file' ' + test "$(test_oid hello)" = $(git hash-object hello) ' -test_blob_does_not_exist $hello_sha1 +test_blob_does_not_exist "$(test_oid hello)" -test_expect_success SHA1 'hash from stdin' ' - test $example_sha1 = $(git hash-object --stdin < example) +test_expect_success 'hash from stdin' ' + test "$(test_oid example)" = $(git hash-object --stdin < example) ' -test_blob_does_not_exist $example_sha1 +test_blob_does_not_exist "$(test_oid example)" -test_expect_success SHA1 'hash a file and write to database' ' - test $hello_sha1 = $(git hash-object -w hello) +test_expect_success 'hash a file and write to database' ' + test "$(test_oid hello)" = $(git hash-object -w hello) ' -test_blob_exists $hello_sha1 +test_blob_exists "$(test_oid hello)" test_expect_success 'git hash-object --stdin file1 file1 && @@ -161,11 +167,11 @@ pop_repo for args in "-w --stdin" "--stdin -w"; do push_repo - test_expect_success SHA1 "hash from stdin and write to database ($args)" ' - test $example_sha1 = $(git hash-object $args < example) + test_expect_success "hash from stdin and write to database ($args)" ' + test "$(test_oid example)" = $(git hash-object $args < example) ' - test_blob_exists $example_sha1 + test_blob_exists "$(test_oid example)" pop_repo done @@ -173,22 +179,22 @@ done filenames="hello example" -sha1s="$hello_sha1 -$example_sha1" +oids="$(test_oid hello) +$(test_oid example)" -test_expect_success SHA1 "hash two files with names on stdin" ' - test "$sha1s" = "$(echo_without_newline "$filenames" | git hash-object --stdin-paths)" +test_expect_success "hash two files with names on stdin" ' + test "$oids" = "$(echo_without_newline "$filenames" | git hash-object --stdin-paths)" ' for args in "-w --stdin-paths" "--stdin-paths -w"; do push_repo - test_expect_success SHA1 "hash two files with names on stdin and write to database ($args)" ' - test "$sha1s" = "$(echo_without_newline "$filenames" | git hash-object $args)" + test_expect_success "hash two files with names on stdin and write to database ($args)" ' + test "$oids" = "$(echo_without_newline "$filenames" | git hash-object $args)" ' - test_blob_exists $hello_sha1 - test_blob_exists $example_sha1 + test_blob_exists "$(test_oid hello)" + test_blob_exists "$(test_oid example)" pop_repo done From patchwork Fri Jun 28 22:59:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11023569 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 38842746 for ; Fri, 28 Jun 2019 22:59:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53EAD28834 for ; Fri, 28 Jun 2019 22:59:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4810E2887D; Fri, 28 Jun 2019 22:59:56 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 BEE5828834 for ; Fri, 28 Jun 2019 22:59:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726964AbfF1W7x (ORCPT ); Fri, 28 Jun 2019 18:59:53 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:56404 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726862AbfF1W7w (ORCPT ); Fri, 28 Jun 2019 18:59:52 -0400 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:f01a:2fd6:a95e:5f84]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 6062D6101F; Fri, 28 Jun 2019 22:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1561762791; bh=T7rijjU2Zgwersyt6zc56DVPUOglzJre5rtDu89Y2RY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=ysLwSDs7BEjtjGLOf8PVGbzbxvjwjnCRo87xCjWPOw6T0u4ZbM1b1/Bj0wkwUsQRw F+7IJgQ2hb/vD0oOakkoH1eaR7dMksZvRY2PAGGsugC0jwZshOSXv4Irh0zrLXgLK8 ZIvbTfxEpXSEfLOygTYvVv707vOcS3Icq4jZQe1eMxHcfdlBBjIga7I8R1+j5ksbMM lJQUSo/IOR6PSemEIqMygJZfAjuKmGZjqU6jpMxfTlLt9LvwMmxe+oBSMSZi5+BTOw RIX00GanMJN3bFOsDT1xr9sVZvatohF/TQ2Nt59/vVC/E6Om3tvWG4O8iKV0cLS8l3 MTI0+kF5sXmRfQe2vjtjLoyE0njDMrWpRxPBzQHRXPfNNCDcKfIQ2rCMBIvPvbZ6H8 b29mE4fkc3HyoNqGhqQm7TeDT7xPRTy5SwRdEcVyh0s3EWW4AtqB+44QqszxEKn5MS x8Hx8+wpxLEA5ndg4yWZFmURIheufM6WjECzNTfMLgv3XbIHM4o From: "brian m. carlson" To: Cc: Jeff King , Duy Nguyen , Johannes Schindelin , Jonathan Tan , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 09/10] t1710: make hash independent Date: Fri, 28 Jun 2019 22:59:27 +0000 Message-Id: <20190628225928.622372-10-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.22.0.455.g172b71a6c5 In-Reply-To: <20190628225928.622372-1-sandals@crustytoothpaste.net> References: <20190628225928.622372-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This test uses several index hashes, which necessarily depend on the version of the index and the hash algorithm in use. Use test_oid_cache to provide values for these for both SHA-1 and SHA-256. Also, compute an object ID and use $EMPTY_BLOB to make the remainder of the tests independent of the hash algorithm in use. Signed-off-by: brian m. carlson --- t/t1700-split-index.sh | 51 ++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh index 4f2f84f309..12a5568844 100755 --- a/t/t1700-split-index.sh +++ b/t/t1700-split-index.sh @@ -20,6 +20,22 @@ create_non_racy_file () { test-tool chmtime =-5 "$1" } +test_expect_success 'setup' ' + test_oid_cache <<-EOF + own_v3 sha1:8299b0bcd1ac364e5f1d7768efb62fa2da79a339 + own_v3 sha256:38a6d2925e3eceec33ad7b34cbff4e0086caa0daf28f31e51f5bd94b4a7af86b + + base_v3 sha1:39d890139ee5356c7ef572216cebcd27aa41f9df + base_v3 sha256:c9baeadf905112bf6c17aefbd7d02267afd70ded613c30cafed2d40cb506e1ed + + own_v4 sha1:432ef4b63f32193984f339431fd50ca796493569 + own_v4 sha256:6738ac6319c25b694afa7bcc313deb182d1a59b68bf7a47b4296de83478c0420 + + base_v4 sha1:508851a7f0dfa8691e9f69c7f055865389012491 + base_v4 sha256:3177d4adfdd4b6904f7e921d91d715a471c0dde7cf6a4bba574927f02b699508 + EOF +' + test_expect_success 'enable split index' ' git config splitIndex.maxPercentChange 100 && git update-index --split-index && @@ -29,11 +45,11 @@ test_expect_success 'enable split index' ' # NEEDSWORK: Stop hard-coding checksums. if test "$indexversion" = "4" then - own=432ef4b63f32193984f339431fd50ca796493569 - base=508851a7f0dfa8691e9f69c7f055865389012491 + own=$(test_oid own_v4) + base=$(test_oid base_v4) else - own=8299b0bcd1ac364e5f1d7768efb62fa2da79a339 - base=39d890139ee5356c7ef572216cebcd27aa41f9df + own=$(test_oid own_v3) + base=$(test_oid base_v3) fi && cat >expect <<-EOF && @@ -99,17 +115,18 @@ test_expect_success 'enable split index again, "one" now belongs to base index"' test_expect_success 'modify original file, base index untouched' ' echo modified | create_non_racy_file one && + file1_blob=$(git hash-object one) && git update-index one && git ls-files --stage >ls-files.actual && cat >ls-files.expect <<-EOF && - 100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0 one + 100644 $file1_blob 0 one EOF test_cmp ls-files.expect ls-files.actual && test-tool dump-split-index .git/index | sed "/^own/d" >actual && q_to_tab >expect <<-EOF && $BASE - 100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q + 100644 $file1_blob 0Q replacements: 0 deletions: EOF @@ -121,7 +138,7 @@ test_expect_success 'add another file, which stays index' ' git update-index --add two && git ls-files --stage >ls-files.actual && cat >ls-files.expect <<-EOF && - 100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0 one + 100644 $file1_blob 0 one 100644 $EMPTY_BLOB 0 two EOF test_cmp ls-files.expect ls-files.actual && @@ -129,7 +146,7 @@ test_expect_success 'add another file, which stays index' ' test-tool dump-split-index .git/index | sed "/^own/d" >actual && q_to_tab >expect <<-EOF && $BASE - 100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q + 100644 $file1_blob 0Q 100644 $EMPTY_BLOB 0 two replacements: 0 deletions: @@ -141,14 +158,14 @@ test_expect_success 'remove file not in base index' ' git update-index --force-remove two && git ls-files --stage >ls-files.actual && cat >ls-files.expect <<-EOF && - 100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0 one + 100644 $file1_blob 0 one EOF test_cmp ls-files.expect ls-files.actual && test-tool dump-split-index .git/index | sed "/^own/d" >actual && q_to_tab >expect <<-EOF && $BASE - 100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q + 100644 $file1_blob 0Q replacements: 0 deletions: EOF @@ -237,9 +254,9 @@ test_expect_success 'set core.splitIndex config variable to true' ' git update-index --add three && git ls-files --stage >ls-files.actual && cat >ls-files.expect <<-EOF && - 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 one - 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 three - 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 two + 100644 $EMPTY_BLOB 0 one + 100644 $EMPTY_BLOB 0 three + 100644 $EMPTY_BLOB 0 two EOF test_cmp ls-files.expect ls-files.actual && BASE=$(test-tool dump-split-index .git/index | grep "^base") && @@ -257,8 +274,8 @@ test_expect_success 'set core.splitIndex config variable to false' ' git update-index --force-remove three && git ls-files --stage >ls-files.actual && cat >ls-files.expect <<-EOF && - 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 one - 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 two + 100644 $EMPTY_BLOB 0 one + 100644 $EMPTY_BLOB 0 two EOF test_cmp ls-files.expect ls-files.actual && test-tool dump-split-index .git/index | sed "/^own/d" >actual && @@ -285,7 +302,7 @@ test_expect_success 'set core.splitIndex config variable back to true' ' test-tool dump-split-index .git/index | sed "/^own/d" >actual && cat >expect <<-EOF && $BASE - 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 four + 100644 $EMPTY_BLOB 0 four replacements: deletions: EOF @@ -309,7 +326,7 @@ test_expect_success 'check behavior with splitIndex.maxPercentChange unset' ' test-tool dump-split-index .git/index | sed "/^own/d" >actual && cat >expect <<-EOF && $BASE - 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 six + 100644 $EMPTY_BLOB 0 six replacements: deletions: EOF From patchwork Fri Jun 28 22:59:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11023571 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 B9F91112C for ; Fri, 28 Jun 2019 22:59:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5E1928834 for ; Fri, 28 Jun 2019 22:59:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9F572887D; Fri, 28 Jun 2019 22:59:58 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 71D8528834 for ; Fri, 28 Jun 2019 22:59:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726966AbfF1W75 (ORCPT ); Fri, 28 Jun 2019 18:59:57 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:56404 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbfF1W7y (ORCPT ); Fri, 28 Jun 2019 18:59:54 -0400 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:f01a:2fd6:a95e:5f84]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 7377461021; Fri, 28 Jun 2019 22:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1561762792; bh=xjTSe1NU0gagAs6yAUNobAN1oT6R968FF3aG7B68HmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=sR1DKOONdQTbudn8VFwjtYM/M1p1k1hSTNCx7F6GSdSnH/s5ZYBzD4FqXuneFFj91 pWmyiMFiPB4tRolNSkpM1ZADD+nrjkJAtpTd9uI8Gip93dYGx3agZ7WvPzoi7x8zoG L0L+vw/p6ealjEzy6pQwDDWjXP672BqoFrnXKY5M/dzL7hc2mK8JPeKiPVho4JEm1g TuBeHz6r9SV7zbc0nhW21/N1YTJzzXyMy0jUSVl8ogtTGg2uI0Awk9AStSRbv3rqYR zv2e3HIOLem4pYuASaxxC6/3b/hN7QrczO0j8Lf61HV+vCJOuClGwWM7Nl3q9m4JER GveySIh6AtEQExNSdWFf2zb+H/qrI+kT+CgsYXwiKWhsMM6SZqg6w+tpiG4aFJjIlU OMURvMMpxolNfP+hsIRcavwc6edp19JrWZhcmocqebY7bRsFE3t6kCUuYp/XeA5Cwe IKdRWmfkEt+XXi1GUiSW+TcijvZVunDsh+gi5KWQAaypeos3Q7U From: "brian m. carlson" To: Cc: Jeff King , Duy Nguyen , Johannes Schindelin , Jonathan Tan , Eric Sunshine , Junio C Hamano Subject: [PATCH v3 10/10] t2203: avoid hard-coded object ID values Date: Fri, 28 Jun 2019 22:59:28 +0000 Message-Id: <20190628225928.622372-11-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.22.0.455.g172b71a6c5 In-Reply-To: <20190628225928.622372-1-sandals@crustytoothpaste.net> References: <20190628225928.622372-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to make this test work with multiple hash algorithms, compute the object ID used in this test instead of hard-coding it. Signed-off-by: brian m. carlson --- t/t2203-add-intent.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh index 68e54d5c44..5bbe8dcce4 100755 --- a/t/t2203-add-intent.sh +++ b/t/t2203-add-intent.sh @@ -247,12 +247,14 @@ test_expect_success 'diff-files/diff-cached shows ita as new/not-new files' ' test_expect_success '"diff HEAD" includes ita as new files' ' git reset --hard && echo new >new-ita && + oid=$(git hash-object new-ita) && + oid=$(git rev-parse --short $oid) && git add -N new-ita && git diff HEAD >actual && - cat >expected <<-\EOF && + cat >expected <<-EOF && diff --git a/new-ita b/new-ita new file mode 100644 - index 0000000..3e75765 + index 0000000..$oid --- /dev/null +++ b/new-ita @@ -0,0 +1 @@