From patchwork Fri Jul 10 02:46: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: 11655483 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 19C3C739 for ; Fri, 10 Jul 2020 02:48:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F3B5020663 for ; Fri, 10 Jul 2020 02:48:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="O+2HCoFI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726664AbgGJCsZ (ORCPT ); Thu, 9 Jul 2020 22:48:25 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40358 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726495AbgGJCsZ (ORCPT ); Thu, 9 Jul 2020 22:48:25 -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 EE8CF607F6; Fri, 10 Jul 2020 02:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1594349304; 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=O+2HCoFIFIZ80WWtmRPwWzC0wt+8/h1QHBHjypWVUGPe7liSYjqxnGx7wWTxIJQzy RQj/2+gaj/wAv4C3T6Sn/SP597SPOjwvKgIiY/4kj/xFMsi3f39YabhOsxdxgDF0aB AOnzFjCi7ITAWlLctwz2gE7dfSlY5ocXDfNBEtkbkJajN5R22eWZOBIcuDI1QJYMfp 2tM4LFPZW2usfCyyshEfP7BttR53zmthcNmpX7lUogKAY3yRXme0IveChvdwBMHhrk hxTa1NBVbkIemp3afplx8QUrpBB+wFiroktGpXaVRbUnU7QDGzrXnRbL/twi1zNTHI 8Wzq3dk58mIbA3Yt1Hkokjd4iPrHXrgVHqPxq/7479EljsGrJHARQYvYObWBs1zXVE /6y5rBsje5Tu9f9OCvBhthbkBmy6E/XDlVS0BhgIFwb3ZpVkYWaZZ22yqdKKxT8wse vvuy+U/EFFl8qBdijFX+M5X+n0Jsm8cn5EFmMaX8BONvr8P/++g From: "brian m. carlson" To: Cc: Johannes Schindelin Subject: [PATCH 01/38] t: make test-bloom initialize repository Date: Fri, 10 Jul 2020 02:46:51 +0000 Message-Id: <20200710024728.3100527-2-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.27.0.353.gb9a2d1a020 In-Reply-To: <20200710024728.3100527-1-sandals@crustytoothpaste.net> References: <20200710024728.3100527-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 Fri Jul 10 02:46:52 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: 11655489 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 B2A6313B1 for ; Fri, 10 Jul 2020 02:48:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 971C020663 for ; Fri, 10 Jul 2020 02:48:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="hmK0x6u4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726872AbgGJCs3 (ORCPT ); Thu, 9 Jul 2020 22:48:29 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40362 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726496AbgGJCsZ (ORCPT ); Thu, 9 Jul 2020 22:48:25 -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 86EB360A5C; Fri, 10 Jul 2020 02:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1594349304; 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=hmK0x6u44/iFg8qcAHNhyB2xHVFzf4QZzjz1metqRVfX3t4J30dquOnJ2DzdK+x0F awCQM3ECA0KLs7OsOwcfCuQJm+ey5lxTs1jS+hTjFPHyWnQM5dqJfCPsQXGfihC706 EQ3kLjeTuWm11OKX5CMwZsv5/gOP65vDmDZ2fUEWMgrMxdduyyJAiFVLcf6pKi0rvx qV46IjfOnsNuyep+S+rvCxp5vrASfpIWfvpKaxtlmjw6H1nOfQDP1NPRuBhg7An7LD kqG9mZ/l8j2hrXhog757iMTyYUARo7Hm7SpZmrZNmoooRyl5yBPrVSrWuyo3+GLATy INfqj7mjEfz7o7kkUf8VKnjdP9Tu7XYb0yIfYwUIwm8nkTRCBHJyOBhENDKB+w4+fa kg7ui03oTPTK96gGmMptM2t2vpWcaGhDlRZ0f20shGEPq3v9tJdRfaESowDE+l13dK x9QmEfyjDcEeL1j9BYL8604iGaRfN9qS7A1xvUDvbkwzDl5C23M From: "brian m. carlson" To: Cc: Johannes Schindelin Subject: [PATCH 02/38] t1001: use $ZERO_OID Date: Fri, 10 Jul 2020 02:46:52 +0000 Message-Id: <20200710024728.3100527-3-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.27.0.353.gb9a2d1a020 In-Reply-To: <20200710024728.3100527-1-sandals@crustytoothpaste.net> References: <20200710024728.3100527-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: 11655485 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 40D9114B7 for ; Fri, 10 Jul 2020 02:48:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E96520663 for ; Fri, 10 Jul 2020 02:48:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="xy4dJeqR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbgGJCs1 (ORCPT ); Thu, 9 Jul 2020 22:48:27 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40366 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726509AbgGJCs0 (ORCPT ); Thu, 9 Jul 2020 22:48:26 -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 EDE7860A5D; Fri, 10 Jul 2020 02:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1594349305; 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=xy4dJeqRXTYswSpUH8nYvOYbwUG3xSwndKUtnKeYa7dPkeHzNGYNDilGmLjb4XGFK 7stnZ9Dgzph9AQRfdw9eQnCSgywXIA8/1I6GCPppSR6WlXzAln8ghfiUZAF+qFZWIo 9/3CIH8bhjM6bOQ8AFk3kv9Q6ivqgwA/q6y6aG8RFW0lNuFdw9K26m1XGD8rV9vsj3 kwC4s7jLF2+Z/qjKe2wbWRP2mQWH3UzqiGTJ7BSSquQCousucZGeuNPc/wWMhgcH3X AdJOPSd3kj+RGDcG+Khl5pWGiamrAFM2vi7g7BnSiOoGfsJ+So+Kexqpu/honHXnav YEkTHWHor+h7OQFsvOqP7qB6xbjpXYjMxqsjHBSGPCGbQ6dHCwMN4SNX0UtgAoD1bh 9w2Suij7+fwJp3t9vrZoundMPP1YE0ql9WqzsXbJubKa7+GrrC74DA/ySGORWsjQbd 28s5ybwOfL0ENrBoJta7zmieh3fAOy7DyQqWRFmFnp4L6rqVsHU From: "brian m. carlson" To: Cc: Johannes Schindelin Subject: [PATCH 03/38] t3305: make hash agnostic Date: Fri, 10 Jul 2020 02:46:53 +0000 Message-Id: <20200710024728.3100527-4-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.27.0.353.gb9a2d1a020 In-Reply-To: <20200710024728.3100527-1-sandals@crustytoothpaste.net> References: <20200710024728.3100527-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 Fri Jul 10 02:46:54 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: 11655487 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 5EB0B13B1 for ; Fri, 10 Jul 2020 02:48:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4622320663 for ; Fri, 10 Jul 2020 02:48:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="1GRDTGQ/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726896AbgGJCsa (ORCPT ); Thu, 9 Jul 2020 22:48:30 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40368 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726495AbgGJCs0 (ORCPT ); Thu, 9 Jul 2020 22:48:26 -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 645C760A5E; Fri, 10 Jul 2020 02:48:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1594349305; 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=1GRDTGQ/F9oRxlfwv4VmS0NmX0MLvxrKp/M4msGHiqPXKu340ZRrtbg3iBMSDA3YS DH81SfyTUWktJsBJ7jmKnPH/whE162P2PkpVrqhLp2W8+26FzXNaHpY9jwLnXYPdW0 AzMdoo51GYCx8kvyltjwnHwt3bUeze/WmAN1gm4K/7B1ON2vCFpcNwedFuM4Ko344E E835l7fLSmqvXqWp5cJLbraoKZzuxi/3KqgE3lP/+TyL3BbslzFBlSVVx+lsgMQD8R r1KLcTY8fYBtTbd42w8kJT8M5s3JFmw+iM6bidXO51GJ8mrHecGylVqcfHIzjYOYVh CUF7QPBuOCCcbXyAGLlBcq5mTmXDVGKas+o0j0SGVaYjfdnBfgM0ZQdhJ+j/hHTzA+ MR2wavZgmYR1jbJAjALPknlVnqSnY0iomnIW2fWrlX4mXtVTtznqSWe3nM48y/hwla xGRL1oli1Ls9jXVCf2I/RLmne23f+yrGNoyewxpXU7iMwAQHCGC From: "brian m. carlson" To: Cc: Johannes Schindelin Subject: [PATCH 04/38] t3404: prepare 'short SHA-1 collision' tests for SHA-256 Date: Fri, 10 Jul 2020 02:46:54 +0000 Message-Id: <20200710024728.3100527-5-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.27.0.353.gb9a2d1a020 In-Reply-To: <20200710024728.3100527-1-sandals@crustytoothpaste.net> References: <20200710024728.3100527-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