From patchwork Thu Jul 23 01:09:05 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: 11679483 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 E4403138A for ; Thu, 23 Jul 2020 01:10:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CBC8B20684 for ; Thu, 23 Jul 2020 01:10:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="IUbSAiAx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387640AbgGWBKX (ORCPT ); Wed, 22 Jul 2020 21:10:23 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40524 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387636AbgGWBKW (ORCPT ); Wed, 22 Jul 2020 21:10:22 -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 7CD246047A for ; Thu, 23 Jul 2020 01:09:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1595466591; bh=Ni60BVyy3697LdUPCNff0L0kAJ2/erkulVYjnf5hQSc=; h=From:To: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=IUbSAiAx9dhPoohIvrdy6yxP0aGxHEIdlG1hRdatGpSLXrBsQWZHWG0E/v5qKVX5p Jr6klDGYtnZ5MBPCM6pA82XeIPtElG3ax+tlLFzCr7HnfVdrabFnU1wk1IvK8hwFiC 22cyYq4fjUMsyZDbNmZVwjK5eb7BhsopOQluIcqg/ztB/ztiy57cQveLBrlFJ+rCZa fq6RKoiuBcyxdk0tNRqsFRxWyfUSttLco3EISAEhoz1WYOg/5mOM99xoex03p8Afnk 9ngBzV86qckOq9PahE9Ek3CQS+SLb13GRtJmvwBlKcvgJKwtcB3Q3p2Xb5WhQXazwi PiTQoFKg0EhaM0KyomwevEM4FHi6A+UvHv4ENsk96mKxPvwf+8HpWrYHHkuVoL+84p ry380oVzxIrfFgS3eH5d2Io5cmSX3dfXPtYXrPJ+AEbo6VRcMgiFeNdv/8ooMyUUfR leL2t9gVmoD80rOdDglsT3VXXUkM7mO+m8XxnIWqOPg2LWYvgf+ From: "brian m. carlson" To: Subject: [PATCH v3 01/39] t: make test-bloom initialize repository Date: Thu, 23 Jul 2020 01:09:05 +0000 Message-Id: <20200723010943.2329634-2-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.28.0.rc1.129.ge9626dbbb9f In-Reply-To: <20200723010943.2329634-1-sandals@crustytoothpaste.net> References: <20200723010943.2329634-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 Thu Jul 23 01:09:06 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: 11679431 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 E164F6C1 for ; Thu, 23 Jul 2020 01:09:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C02522080D for ; Thu, 23 Jul 2020 01:09:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="FD8XRwDz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733275AbgGWBJx (ORCPT ); Wed, 22 Jul 2020 21:09:53 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40482 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728607AbgGWBJw (ORCPT ); Wed, 22 Jul 2020 21:09:52 -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 DF1E960758 for ; Thu, 23 Jul 2020 01:09:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1595466592; bh=kzD44krolsMhdpvZfmNLjC7VTRRu/RTNvK14D0Rz7Vo=; h=From:To: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=FD8XRwDz4xyLvupTlSX0DwL+SsA6BVzo3hlhrS/2XkxQYhE1mGfsrzzmmsw8S4z1K RMyWU6zoFOG2fHg7d19iecHiP23xLXYSXC7fENLsOJnyuGFOxlTJ7KA2UzzBK8wf4m c0H2B2C9Ne0EMUsOiRndXQsSEj75+mSlZ/nq7G0sgNK7ZwDHFJWwobUMec8nQjUfYR IyHpHnnaaWIi/rmeKvtRKsQlIV62ibDeBUqDBXKX9XvBkzFXUVgMmnKe6QtrceAejI SI6o1cPvit9Fp0Y3w9RFsdqQGwnll0GPms2/dlEVAlQvmqkIChNSSvh9iVZKFGSlQS ojrRqqHx4/jRA0TtVhQjkNeYRD27RHbd5mnMFtIGL5KhjuZz0Arcjm0P62rxz252AF kwc78QOIM9XRHHnDNYp3je1iJM2jdKfw+3VxkX/0VtmpNf+y7J2vi8gpED2UIf9QUs A8kyWQK1sS++usvgx7NgOxaFRfcQDsp1/mUXD/gkkXmu5EEOlnB From: "brian m. carlson" To: Subject: [PATCH v3 02/39] t1001: use $ZERO_OID Date: Thu, 23 Jul 2020 01:09:06 +0000 Message-Id: <20200723010943.2329634-3-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.28.0.rc1.129.ge9626dbbb9f In-Reply-To: <20200723010943.2329634-1-sandals@crustytoothpaste.net> References: <20200723010943.2329634-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: 11679433 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 E9A036C1 for ; Thu, 23 Jul 2020 01:09:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C745122B43 for ; Thu, 23 Jul 2020 01:09:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="CK6dBcl+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387413AbgGWBJy (ORCPT ); Wed, 22 Jul 2020 21:09:54 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40484 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729401AbgGWBJx (ORCPT ); Wed, 22 Jul 2020 21:09:53 -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 440D2609CF for ; Thu, 23 Jul 2020 01:09:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1595466592; bh=OgCPGLxbLEhOK6+oRjiyLc+hvZl35cGnjxku2gGi4NE=; h=From:To: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=CK6dBcl++hKxvhDfiOSOXPcLIMOMgkjgW2uzcGwHD6SpaUc/6f1Y9qPo0/fubfkGw HpI7mjn47jYcHdv+av6LvfSAnyaKExLWtXUAIAgPlhneTfIdFVhfBLZYVIfMqkgmgt CzdIn83Xqxf+IQzg9O3wj8QngOjV7UcKfmxWRLI6EHiW1B7+jfpw8TAASlHJgiiumE egjWFxA3fZqF09Jz1UyBCldP3LEfVb7LpC25mRe73uzm9XWMG5xWDLB9zGanjpAMoX AOv1EKM3uz1ouBsbPvq2ZcZiHa4sqV3yANzxa71i5Ikmjhc7cn53HsOLZoQBezmZ6z g14RmZ+AeTk9MxNrIQoQLATSjDqDbF8WNCscC5mc9y7Ud3e58hdUQYeKTfEFOVbqCx wBzbjwv3eO2BFjwtYgWd9QCIBRirWZlDNFnu9CAhwVPX7bW8+7kZugQsRT63tqDWi0 zQ4vkJbTyO+RGuuBLHSRsAVITdX0yEx6QvfxOUu5YRPpnSYYzRc From: "brian m. carlson" To: Subject: [PATCH v3 03/39] t3305: make hash agnostic Date: Thu, 23 Jul 2020 01:09:07 +0000 Message-Id: <20200723010943.2329634-4-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.28.0.rc1.129.ge9626dbbb9f In-Reply-To: <20200723010943.2329634-1-sandals@crustytoothpaste.net> References: <20200723010943.2329634-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 Thu Jul 23 01:09:08 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: 11679477 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 F0B8F6C1 for ; Thu, 23 Jul 2020 01:10:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D76C220771 for ; Thu, 23 Jul 2020 01:10:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="N+Fq2ack" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387530AbgGWBJ4 (ORCPT ); Wed, 22 Jul 2020 21:09:56 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40486 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733175AbgGWBJy (ORCPT ); Wed, 22 Jul 2020 21:09:54 -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 9C6F760AFD for ; Thu, 23 Jul 2020 01:09:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1595466592; bh=xt7+S0YGkL78M65P52Ea3illT0Bx0Eyn9uNik2bjA/k=; h=From:To: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=N+Fq2ackoe1EjjG8a3TVoCZytyISp7+r8K7Q0u6C/Qssam6BbeS7hvUJtPVnB8LJX /cpZJTpBGJct4YMp+9HWeH2cHmCZgYRN1mqyDimshtXZfJW83HZ1h86IWXuouw2R1k 1Qb2E4GGnpLvSfwo58fAq2fEkVMQ0kb0g3S8hCcbjTNGsg4uGnM5edjNdPnkowBPob NXll2ilYDjtCslnM0luhkJRDnK5paSs5jRi7Nppbj5g78wzCKZQf5xRzzvvqjKPkll 9aIYphESrgCBjCwgoUwc3Z5+87sH/jfL4p0/2hbPpEcsk/ZXGBZyqA19IXq3mz7ot9 F+xXk/Urc/sHs6JsanmcwtPHRWeji32rCmXvvCfiDQU2nWwXDKxqqYYfewNpFs7Htc XTnPXW1Ig+nPTb7B7X8/9ajbZo3z5ZsjTbdhA5Age2u5xGuYa3/s6GDykC3bPko731 d5Eud815t5uzqZ7pYH/svwUXRwYys0WgbwdbMkgYFveiALzzxiE From: "brian m. carlson" To: Subject: [PATCH v3 04/39] t3404: prepare 'short SHA-1 collision' tests for SHA-256 Date: Thu, 23 Jul 2020 01:09:08 +0000 Message-Id: <20200723010943.2329634-5-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.28.0.rc1.129.ge9626dbbb9f In-Reply-To: <20200723010943.2329634-1-sandals@crustytoothpaste.net> References: <20200723010943.2329634-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