From patchwork Wed Jul 29 23:13:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11691839 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2BDD13B6 for ; Wed, 29 Jul 2020 23:14:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B712207F5 for ; Wed, 29 Jul 2020 23:14:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="K0xOziYc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727896AbgG2XOr (ORCPT ); Wed, 29 Jul 2020 19:14:47 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:41032 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726718AbgG2XOr (ORCPT ); Wed, 29 Jul 2020 19:14:47 -0400 Received: from camp.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:b610:a2f0:36c1:12e3]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 3A5D16079A; Wed, 29 Jul 2020 23:14:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1596064486; bh=Ni60BVyy3697LdUPCNff0L0kAJ2/erkulVYjnf5hQSc=; 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=K0xOziYcFSYiV1OpRGUsvAqvxvFqPzkfBF/9egvEkDW+/ZXh4m/tQThWEap6OP+P1 TFEU8f5sJv7O4TZMVrbKIfADK+IDM4H8EGdjfFW0libBTYIVtfbGXC5LRiJuNmiEag RsABurmdQVr3vkKg10DGnylI12wWVyN/HGtN5WJx/s43iuOvyegE2EqIAVNuDUtoPK zqHNFS7Kdqv8nEbhob6px1yGZ7oa57V5wrKtavpVNQXhlcWOpfC+1wOHs1MXO4L0Df m9/tb4Keek6rh+vloQpmUD857+HJXWAyZS/Tc5+6f3J7i7D3x8VFAWcglvjhJ372va si+F5opbtFPhp4M2Bxocy3BX2ijwsygxYM3NmRHuigr0CKPIySVxaGW/VA3sT+Uk9e BOe1hGlGqz7reH2i79mtbjSe9dkOlTPMTvEdgnbqCFW92r+I4BMv+tDwOFd4Bo63Ow JO3N7LOfTjhxpoxnz39NBzRg8s+EohOg5SKz6s92ao7GqiEbk04 From: "brian m. carlson" To: Cc: Eric Sunshine Subject: [PATCH v6 01/39] t: make test-bloom initialize repository Date: Wed, 29 Jul 2020 23:13:50 +0000 Message-Id: <20200729231428.3658647-2-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.28.0.163.g6104cc2f0b6 In-Reply-To: <20200729231428.3658647-1-sandals@crustytoothpaste.net> References: <20200728233446.3066485-1-sandals@crustytoothpaste.net> <20200729231428.3658647-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The bloom filter code relies on reading object IDs using parse_oid_hex. In order to make that work with an appropriate size, we need to have initialized the repository's hash algorithm. Since the values we're processing depend on the repository in use, let's set up the repository when we run the test helper. Signed-off-by: brian m. carlson --- t/helper/test-bloom.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c index f0aa80b98e..5e77d56f59 100644 --- a/t/helper/test-bloom.c +++ b/t/helper/test-bloom.c @@ -50,6 +50,8 @@ static const char *bloom_usage = "\n" int cmd__bloom(int argc, const char **argv) { + setup_git_directory(); + if (argc < 2) usage(bloom_usage); From patchwork Wed Jul 29 23:13:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11691903 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5D0C722 for ; Wed, 29 Jul 2020 23:15:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5D3A20809 for ; Wed, 29 Jul 2020 23:15:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="guKwe5TN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728159AbgG2XPT (ORCPT ); Wed, 29 Jul 2020 19:15:19 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:41150 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728142AbgG2XPR (ORCPT ); Wed, 29 Jul 2020 19:15:17 -0400 Received: from camp.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:b610:a2f0:36c1:12e3]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id BB32C6079B; Wed, 29 Jul 2020 23:14:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1596064487; bh=kzD44krolsMhdpvZfmNLjC7VTRRu/RTNvK14D0Rz7Vo=; 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=guKwe5TN8I4T4+DWpL3CoK4FOnDwLNfonY3F+I88AJ7MynyBhRHci2HuTv9CcV5V2 AMtyDNHfJzxh+W/lrZ+OQqCTezTGghpKB4Ip/5vQYiqOJ8DsoZaCWGpSsthoAWnIb6 fqYqrbVHxuR2nOqV9PRB69f084fM4G0t9+CFAmyuzOhg6tgU5nyiTsGpjGDD5EGg68 Xs2M963HNeol0u2Epx8DlUfTTXLRE0qOXjBQ0pb/bC6yiuyBZOaDdwAE/Ii69AsFYs OMOIO5nIdaOt9i0bMz+ez8ZSCNGeGDHaeCC3ELKwKIQH8Is0zgkdq2iUet8OHXD5Jv 5DBOcJRK3DRTkdsaI7i+9P8FJ0ugKWySJsjvXfF7eoy3QDWdemd1ejjDCe5Dktb0tG 6jOJPhcicxb/ykT6KIFSv4dOjOBtB2/Ix6SzY0jD+gmqsHJyHLkBQkcrddQsWHJIC7 V+YdurrR3FJMIlva9IgRAq89kGnMdKxI2aQlhxFjIXkGPKnFLCE From: "brian m. carlson" To: Cc: Eric Sunshine Subject: [PATCH v6 02/39] t1001: use $ZERO_OID Date: Wed, 29 Jul 2020 23:13:51 +0000 Message-Id: <20200729231428.3658647-3-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.28.0.163.g6104cc2f0b6 In-Reply-To: <20200729231428.3658647-1-sandals@crustytoothpaste.net> References: <20200728233446.3066485-1-sandals@crustytoothpaste.net> <20200729231428.3658647-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Use $ZERO_OID to make the test hash independent. Signed-off-by: brian m. carlson --- t/t1091-sparse-checkout-builtin.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh index 7cd45fc139..84acfc48b6 100755 --- a/t/t1091-sparse-checkout-builtin.sh +++ b/t/t1091-sparse-checkout-builtin.sh @@ -369,7 +369,7 @@ test_expect_success 'sparse-checkout (init|set|disable) warns with unmerged stat git clone repo unmerged && cat >input <<-EOF && - 0 0000000000000000000000000000000000000000 folder1/a + 0 $ZERO_OID folder1/a 100644 $(git -C unmerged rev-parse HEAD:folder1/a) 1 folder1/a EOF git -C unmerged update-index --index-info tweak/deep/deeper2/a && cat >input <<-EOF && - 0 0000000000000000000000000000000000000000 folder1/a + 0 $ZERO_OID folder1/a 100644 $(git -C tweak rev-parse HEAD:folder1/a) 1 folder1/a EOF git -C tweak update-index --index-info X-Patchwork-Id: 11691883 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36F4113B6 for ; Wed, 29 Jul 2020 23:15:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C555207F5 for ; Wed, 29 Jul 2020 23:15:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="tJS50CE+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728163AbgG2XPT (ORCPT ); Wed, 29 Jul 2020 19:15:19 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:41152 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728155AbgG2XPS (ORCPT ); Wed, 29 Jul 2020 19:15:18 -0400 Received: from camp.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:b610:a2f0:36c1:12e3]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 30874607A2; Wed, 29 Jul 2020 23:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1596064487; bh=ZPoC5ssbhrXfBhfkPWrIH9XL3MN0grtVK0m1KwB5YGU=; 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=tJS50CE+jAPzWBGIP1uOZnleDc/9Qwhw3y4EguFcEERkQVnyevGQ7f7NBQ6DO54jU fJPhARuPekMZBoUprussq4fR3KeKnwz+WJrRfF335lXRnNi9pisvv4xzSHKSv79ZFv C8gc57R4r4fqZ8I/FdxY/a2wdi5ApTRNtquz5+APC3NYrvuHuvMOExr4hxQ5BjstPb fVt3vQdZYWHq4mXokTf7Cq/VtEdjwcwITYOBNRcVlLHTWClWs6X7az4mQkV5ZZpioj 3xKOuo1+vA8SNlPmLV0c9uMAM+CYDEbc4OwBuKVbaOOxBVnH1PyJET6OqIQSucBWOg 7koD/Yg4yuBxibNJVo4P34XCMfoon3mcNS1qbznPQ+szICtEbDTp7YQuVkn0zL+3hx INcXxqkzmSBeT4/bhQ3MiHG7/fRt5Rgn3+IdPKdhqnI7ZspiHXcyYd6rzS9T6net+p qYs+W5fup4f7JFwhtMkbIw3Gik203c2VDNQp2pqs0BR3WdrCNRb From: "brian m. carlson" To: Cc: Eric Sunshine Subject: [PATCH v6 03/39] t3305: make hash agnostic Date: Wed, 29 Jul 2020 23:13:52 +0000 Message-Id: <20200729231428.3658647-4-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.28.0.163.g6104cc2f0b6 In-Reply-To: <20200729231428.3658647-1-sandals@crustytoothpaste.net> References: <20200728233446.3066485-1-sandals@crustytoothpaste.net> <20200729231428.3658647-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When computing the fanout length, let's use test_oid to look up the hexadecimal size of the hash in question instead of hard-coding a value. Signed-off-by: brian m. carlson --- t/t3305-notes-fanout.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t3305-notes-fanout.sh b/t/t3305-notes-fanout.sh index 3b4753e1b4..94c1b02251 100755 --- a/t/t3305-notes-fanout.sh +++ b/t/t3305-notes-fanout.sh @@ -7,7 +7,7 @@ test_description='Test that adding/removing many notes triggers automatic fanout path_has_fanout() { path=$1 && fanout=$2 && - after_last_slash=$((40 - $fanout * 2)) && + after_last_slash=$(($(test_oid hexsz) - $fanout * 2)) && echo $path | grep -q "^\([0-9a-f]\{2\}/\)\{$fanout\}[0-9a-f]\{$after_last_slash\}$" } From patchwork Wed Jul 29 23:13:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11691841 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E4CD13B6 for ; Wed, 29 Jul 2020 23:14:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49E0F20809 for ; Wed, 29 Jul 2020 23:14:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="ibWbBOjV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728015AbgG2XOu (ORCPT ); Wed, 29 Jul 2020 19:14:50 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:41044 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726718AbgG2XOt (ORCPT ); Wed, 29 Jul 2020 19:14:49 -0400 Received: from camp.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:b610:a2f0:36c1:12e3]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id AA6516079A; Wed, 29 Jul 2020 23:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1596064487; bh=/7JY2zYnMWAyizSEiCqVtpsg7RZIoduRK486w/OzXs0=; 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=ibWbBOjVdIKvI6YXeeZ3uPAYjb0VVh6mYLlaX2Yx/KV/lNnEDXZZPtjdjZY1GpDXj EBDPbRxPPmRdfFv4RF2aPkm02RAmmumfTNVRHY4zi4DztRgbk6qRaxXziFir9bArSZ 9GwuZexqRjGPPxHl+yqoU8nwYIwj0eLVCkPEAeS8NeEBv88xG1W0LLoSUfGWNUg6ZY kx/i0leYthTx90NsfA7NW11PKC0l1QYDDBVCwTe2a055te+yQQPBim8GtZK9NKkgEm G4xCi0B/Nokx6r4qqAa9vFV3hrDe1w4ZGN3DDihAr573w1cS/4kpnV5A3baT4x4KCY 19Dxe0XAb3P38V4gYpD+n0kQP+dyZmdmefk6P+Y3jiRxQdIbSW4LxFaCoasbDgTs5H sZChfa8tOr3+qFCiZbFHPzbw7Wjs3kj1cWRbfNGcKbddXO7C1HcZcxC1fk9PySMToF uPVc9KCcTsMIKV9A65paPrmjEt4UGfFd6Q7u43LmyQCynf9Sx1D From: "brian m. carlson" To: Cc: Eric Sunshine Subject: [PATCH v6 04/39] t3404: prepare 'short SHA-1 collision' tests for SHA-256 Date: Wed, 29 Jul 2020 23:13:53 +0000 Message-Id: <20200729231428.3658647-5-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.28.0.163.g6104cc2f0b6 In-Reply-To: <20200729231428.3658647-1-sandals@crustytoothpaste.net> References: <20200728233446.3066485-1-sandals@crustytoothpaste.net> <20200729231428.3658647-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin The idea of the magic value "ac4f2ee" in this test is to make the reworded commit `collide2` have the same shortened ID as the commit `collide3`. To port the same idea to the SHA-256 version of Git, we therefore need another magic value that causes the same collision, but this time with the SHA-256 version of the commit IDs. In this patch, we add code guarded by `GIT_TEST_FIND_COLLIDER` to do exactly that. Essentially, a large number of integers is appended to the commit message "collide2" to find such a collision. To make it easier to find such a collision, we reduce the number of digits to 4. As the tests are no longer dependent on SHA-1, we also rename their titles to talk about "commit IDs" instead of "SHA-1s". Signed-off-by: Johannes Schindelin Signed-off-by: brian m. carlson --- t/t3404-rebase-interactive.sh | 49 ++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 4a7d21f898..9744e88760 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -1250,7 +1250,7 @@ test_expect_success 'rebase -i error on commits with \ in message' ' test_expect_code 1 grep " emp" error ' -test_expect_success SHA1 'short SHA-1 setup' ' +test_expect_success 'short commit ID setup' ' test_when_finished "git checkout master" && git checkout --orphan collide && git rm -rf . && @@ -1262,23 +1262,54 @@ test_expect_success SHA1 'short SHA-1 setup' ' ) ' -test_expect_success SHA1 'short SHA-1 collide' ' +if test -n "$GIT_TEST_FIND_COLLIDER" +then + author="$(unset test_tick; test_tick; git var GIT_AUTHOR_IDENT)" + committer="$(unset test_tick; test_tick; git var GIT_COMMITTER_IDENT)" + blob="$(git rev-parse collide2:collide)" + from="$(git rev-parse collide1^0)" + repl="commit refs/heads/collider-&\\n" + repl="${repl}author $author\\ncommitter $committer\\n" + repl="${repl}data <script && + git fast-import