From patchwork Mon Jul 13 02:48:31 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: 11658535 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 3C7EA6C1 for ; Mon, 13 Jul 2020 02:49:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22DF9206F4 for ; Mon, 13 Jul 2020 02:49:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="niSJkiBc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726684AbgGMCtY (ORCPT ); Sun, 12 Jul 2020 22:49:24 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40586 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726267AbgGMCtX (ORCPT ); Sun, 12 Jul 2020 22:49:23 -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 D0A21607F6; Mon, 13 Jul 2020 02:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1594608563; 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=niSJkiBc17s03ooH6EEv0WAvn5C8aC2cGlY61dzIWxtAT/QfmNpufUC3HB06vARMy 92hi4Hmh97LV5ki7Y1epdbAWUfUdjOMWOnLdYMUzzuUBH2C6fto3KYKizlLFp3Jo9+ nIGNl5i7AmyrlhA9nGVB2wB8CKSnI7aK64xk9bq6bUM2ZaMglXEdPddA5gCGs7PJ8l mpcvvR4fIBG3bYM1sVFxWmep0TMV49b9GAU4gJ/zTDl7/ZJQUuPPeQbNobCC9bstoh v47PtGXug+FrUL49cxvGpZ83wJoRT4BCZeNlIBo8xXMIs5paBIuk9UorHPbRf6YNiZ LYD1iHVRURSVPYCmCQqWDRL8Yz5QIK7bjj62FF9Y+Z25zuRsoulf5gg0Y++k1ipnet ZcwQmvV43I+XJubZ9oso5n9koCy1o+g6nGpZba3anf81WFDmSwEKyTQFyBW9guquPk FPX9RnqC+rYGseg2srXk1Ei/1qzorNsrYbUtCyyviDIzAEB8Ia/ From: "brian m. carlson" To: Cc: Denton Liu , Derrick Stolee Subject: [PATCH v2 01/39] t: make test-bloom initialize repository Date: Mon, 13 Jul 2020 02:48:31 +0000 Message-Id: <20200713024909.3714837-2-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.27.0.353.gb9a2d1a020 In-Reply-To: <20200713024909.3714837-1-sandals@crustytoothpaste.net> References: <20200713024909.3714837-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 Mon Jul 13 02:48:32 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: 11658557 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 C2EC66C1 for ; Mon, 13 Jul 2020 02:49:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4379206F4 for ; Mon, 13 Jul 2020 02:49:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="mnDJwrTT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728057AbgGMCt2 (ORCPT ); Sun, 12 Jul 2020 22:49:28 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40592 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbgGMCtY (ORCPT ); Sun, 12 Jul 2020 22:49:24 -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 5FD5660A5C; Mon, 13 Jul 2020 02:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1594608563; 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=mnDJwrTTQAcRYFL4IS5NzX9A0O/fUgCXfqQwBQLDCEFvkOv4Yh9jYPjRFlB2YaJky 19MKZxMUW6sDY3KDcIip7ZVvip9q/YLb8Xm/NZIHcHBDaq71igr/ewqdD6OTltmoQZ X87wgM56oBG9ra0eHT42cIOYUopT/Pv/K5ZdKYMdrREseGr8qFtQUSqbn6+UdZHBUU u2XIMoEXQ5GWl/XTISbWagvSC5WFnukwZGQ91TaX644iE8acMqVr6iOaTBCYbeBcGf OsFE0Y3951yLZsmvdxMrZEDbLTG5Y1eVjFndF14NAsA2Kwu9VO3UCwLAU8fVxJ2eGp Eo7UEsW2bffkbEA36CwaeNylTfZmISgWXU8CVoe4O7KaW6QXHHYfHe4dsBQEgYtc6f o3L6H6HUMUwjk5RPPXN5MyHGu6f7m3cLit3a28hlW/Xm+HCgSW6BvHIqsQLT1QYphy mx1BOVsHiZo3dpu51tFyCvCg57cSStRwKoQ5qPo2TWLeuJStGzL From: "brian m. carlson" To: Cc: Denton Liu , Derrick Stolee Subject: [PATCH v2 02/39] t1001: use $ZERO_OID Date: Mon, 13 Jul 2020 02:48:32 +0000 Message-Id: <20200713024909.3714837-3-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.27.0.353.gb9a2d1a020 In-Reply-To: <20200713024909.3714837-1-sandals@crustytoothpaste.net> References: <20200713024909.3714837-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: 11658575 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 9A38C6C1 for ; Mon, 13 Jul 2020 02:49:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8271A20725 for ; Mon, 13 Jul 2020 02:49:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="0ILhpKWK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728691AbgGMCt4 (ORCPT ); Sun, 12 Jul 2020 22:49:56 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40790 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbgGMCtz (ORCPT ); Sun, 12 Jul 2020 22:49:55 -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 D9B3560A5D; Mon, 13 Jul 2020 02:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1594608564; bh=OgCPGLxbLEhOK6+oRjiyLc+hvZl35cGnjxku2gGi4NE=; 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=0ILhpKWKe03vK2HE7rDnAPjvUOaXRRxUgDNWfwWK0WX87xitY8NS4Ew9wOk2N2IMs oPSHfocfCycYKK3uueUtdGyzGTXEo3oKHq2JLeaJAcrcyzkwwHyPejIblSMfuiLvrU 6zgq+0FbpQt7+ugX0HyMFIWcP+PVrrnratrwrEQYdWwz1xXM90X8/4WjXDdPp392g8 DS1ot1AnK9OsPurzv6m2uV4GHNkIxQSegAgMGJXrOz2eS0Hyb2FC38+/FhJuWSatZe QqkG59poTlHsx9hSWqqjrQOO4Ab657+6WbXiC4CdnEVl81D6c036i4h796GUQ+tInI c0UP34iIAh0fmQBG+8LkxigLPbaOJ7kZD122BO/AVgP69lnc+JPkwS2iuapnYnjxMN EdypRpkuENSs/3z7nKnsIQ5EWy8JHIcVGDUsIZ1qeUi9G32lXHinEV+UZnw3N0Pc33 lQ7WiZ+DpWRSjJZopsT09vVBmQr0jEeUdrxgDf1vtlCLbxaG2Fc From: "brian m. carlson" To: Cc: Denton Liu , Derrick Stolee Subject: [PATCH v2 03/39] t3305: make hash agnostic Date: Mon, 13 Jul 2020 02:48:33 +0000 Message-Id: <20200713024909.3714837-4-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.27.0.353.gb9a2d1a020 In-Reply-To: <20200713024909.3714837-1-sandals@crustytoothpaste.net> References: <20200713024909.3714837-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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t3305-notes-fanout.sh b/t/t3305-notes-fanout.sh index 3b4753e1b4..d5a94b7174 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\}$" } @@ -31,6 +31,7 @@ all_notes_have_fanout() { } test_expect_success 'tweak test environment' ' + test_oid_init && git checkout -b nondeterminism && test_commit A && git checkout --orphan with_notes; From patchwork Mon Jul 13 02:48:34 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: 11658579 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 B126513B1 for ; Mon, 13 Jul 2020 02:49:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97DB4206D9 for ; Mon, 13 Jul 2020 02:49:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="pSuLOnZf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728708AbgGMCt6 (ORCPT ); Sun, 12 Jul 2020 22:49:58 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40792 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728686AbgGMCtz (ORCPT ); Sun, 12 Jul 2020 22:49:55 -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 5E30F607F6; Mon, 13 Jul 2020 02:49:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1594608564; bh=xt7+S0YGkL78M65P52Ea3illT0Bx0Eyn9uNik2bjA/k=; 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=pSuLOnZf+WKic6ToR+Fa5vdopSL7gVbrYHxueljfuAcTkhbWQgoSucHTFKzbunhN5 xXzxbg89OsSgnwSnBcqELnz1K0JLDJ5PaJnC6sR5xjdmfyTqBBfGEOD0SD3O+qJ0+P F47yrhYEe2RdCt8ixDz7j4Y032+dgMXZ3/xOETdjJy64h5QKF5s9YcJLf5QtahlQEG 2e2TRifS3BKkio6bqHSEa/sldcOk4Bjgtpd5XS8SZA/5Dp7d5/ilnzbvJfY30j/I+G m1eFMMGqY/hgjAegmqdTrXLlwJHXJVrQVMh6B/qIrcqH/Zgj/Hu4Qom6J/SGh5Vn/S DFPGxdlKpJoU9KYsy23EcLvR9bHb2aZgV/iPCi1kMZ/H0sJ3Hkvs2yu7E0ADTo9T3d yXlkRvikA8cIaP7T63n7/9Gw/JJhV7vmbchUPus11MOPk6GgP5I4M1Qj/aAJuun1vZ eSHhUkcCDzAjP4jBTlLKYdZKCyi4s6YIRPHzVDMIIBGFRNsWFAy From: "brian m. carlson" To: Cc: Denton Liu , Derrick Stolee Subject: [PATCH v2 04/39] t3404: prepare 'short SHA-1 collision' tests for SHA-256 Date: Mon, 13 Jul 2020 02:48:34 +0000 Message-Id: <20200713024909.3714837-5-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.27.0.353.gb9a2d1a020 In-Reply-To: <20200713024909.3714837-1-sandals@crustytoothpaste.net> References: <20200713024909.3714837-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. The `t/oid-info/oid` file now lists the values found in that way, and the test cases are modified to use those values. 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 | 50 ++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 4a7d21f898..2fb2c581cb 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -30,6 +30,7 @@ Initial setup: . "$TEST_DIRECTORY"/lib-rebase.sh test_expect_success 'setup' ' + test_oid_init && test_commit A file1 && test_commit B file1 && test_commit C file2 && @@ -1250,7 +1251,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 +1263,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