From patchwork Sun Jul 26 19:53:46 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: 11686031 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 E71C11392 for ; Sun, 26 Jul 2020 19:54:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7B9E2065F for ; Sun, 26 Jul 2020 19:54:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="Fyh2WNzh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbgGZTym (ORCPT ); Sun, 26 Jul 2020 15:54:42 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40652 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726801AbgGZTyl (ORCPT ); Sun, 26 Jul 2020 15:54:41 -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 CE6EE607E8; Sun, 26 Jul 2020 19:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1595793281; 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=Fyh2WNzhWMh79migcveGLGD851Y7iFcGi4towx4Dx2n06tLKxvP7JNx2VW5bMpbcH sCpD4by17RO7D/ugJqcJehllLC992tgIR5XnO/5Xdfi1ojdu4LZ+59GxqCch6RiuS3 MsdNMTL1B+nDGnYzOHLbNtk+YAXpLvkWhdVqPiXMxmwI+LhwsOscGBAOi7It7sxLt4 oQoAA2pdUmI9XBbRGZ6qKG25SDu39ygaPUAuWUv84d+1L84uYr1ZcgxHEDcJ4yA4au vI4VYACRwg+wAB2fmpWjaO1yKgZNIjVPZwH1oMRWLaS7JFybmVih+7I5ff9Z2OZUPY N/8h+OwRmR+APd7HKl5gF5NffOfNOsBCS0EsfKziIGpWR1wiaBwmXC7sH5fPAzT8HS uAeEONnBmSvh2bz6k5NaG2p7AK5OSMayALplJkjnAwkq+C/HBx0K8v0ARZ2dIavDo6 OhNWP6SS1mtp1kyKO2LwftU2fdpIFRHrSkC41ucN9FOIR771E2a From: "brian m. carlson" To: Cc: Eric Sunshine Subject: [PATCH v4 01/39] t: make test-bloom initialize repository Date: Sun, 26 Jul 2020 19:53:46 +0000 Message-Id: <20200726195424.626969-2-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.28.0.rc2.160.gd0b3904b262 In-Reply-To: <20200726195424.626969-1-sandals@crustytoothpaste.net> References: <20200726195424.626969-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 Sun Jul 26 19:53:48 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: 11686087 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 240F56C1 for ; Sun, 26 Jul 2020 19:55:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DC4320719 for ; Sun, 26 Jul 2020 19:55:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="QMg6Zqd3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728067AbgGZTzQ (ORCPT ); Sun, 26 Jul 2020 15:55:16 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40774 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727955AbgGZTzO (ORCPT ); Sun, 26 Jul 2020 15:55:14 -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 C52B760AFD; Sun, 26 Jul 2020 19:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1595793282; 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=QMg6Zqd3hZDiomwo8Ld5WKjUIERnkUU4iRscjuhpZoABctZvK5l0FNLen7G50Ce3x 0ciHOuD5m+zdkGBKgtQuSH6yPVsJa02qpQWXuA9WJA3BAZJAvOj1fiVHZ387oBxf01 UfPdI1lEseyUy3R5MGMoxT/qiJ+TxCKD/O/W/KFVrc0la6dUwddKuehMjKF4I1CI4q HusE0a4rWIBxfP4U0qu7OTSBLFPxUBQsHTRXATd8RuajmVqQDaW23viXAvhVm7jdfU cQd3hi8Obb63v1wKmeDKok0KFbkMsPlbsTNocCr4q69lTJUtOsStGmo2tq/aRaSD6D /Meq2lnUnAqROkBCQ+6Ue4sfe/Khs/tcvTmmhdTLRAYr3EhCd7pyeE+XbveYvYxqFx 1kFsG13wSVc8tNsErtDhAzi4ZUSZiXdV9iMdOJ26m8n+C5CV2a0Fkdy4E++uLLlB/i 3qhWxuJNgGJ8k56LUZJQbuYHOjgBKgtxiNre7dkcisg3hraJeLH From: "brian m. carlson" To: Cc: Eric Sunshine Subject: [PATCH v4 03/39] t3305: make hash agnostic Date: Sun, 26 Jul 2020 19:53:48 +0000 Message-Id: <20200726195424.626969-4-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.28.0.rc2.160.gd0b3904b262 In-Reply-To: <20200726195424.626969-1-sandals@crustytoothpaste.net> References: <20200726195424.626969-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 Sun Jul 26 19:53:49 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: 11686037 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 5AC4013B6 for ; Sun, 26 Jul 2020 19:54:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 39B7A2065F for ; Sun, 26 Jul 2020 19:54:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="OkxmjE1n" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727852AbgGZTyp (ORCPT ); Sun, 26 Jul 2020 15:54:45 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40666 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726801AbgGZTyn (ORCPT ); Sun, 26 Jul 2020 15:54:43 -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 3A7A060CF4; Sun, 26 Jul 2020 19:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1595793282; 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=OkxmjE1n8Ebq+sLEIfpobceobxwILfQjpNcT50mQdj19ilblBcZuzuviYzZV7BEW0 ZPiH7cXlABC8J4jti+E/kuZ71xaYHoiRTfhobjdaISEB7sWmJCmqiV7LdT/a/gVo1v 4/Xk9o8uBm8Tm2sfP1PoTJlDtNijKqiqRsFRWyOsrK4kti9ILoAQ3Hh0wslttRDbEw oFyIx2XP9W9RWYgOJJCAZgbAab31C/QYA0Pa7ybpRo5zNCQneT+YUeid0qBJhf9VC7 sHIK7BlB5yRtiIprrrnYDWr9JtemXInB+/YhEvZ6MNymROcqgfeGJvhb86/iLHAvTV Qpy7WmvUc6VkcJ7UH8Uj7hMLEXz4+LkyXudtasHrO991YmWoKNMBeo4EXiMg2EPJbS 3i81CzYZxSvTvABUF4wGw0TGm6hGUksf/bTRFRvSfadzL0N8ekVo9tIG876WdNs3M4 wAYNzvoWiq54Q4KUp9Mr++buQumU3phF6q+BQGHVwdWsSSPDzCJ From: "brian m. carlson" To: Cc: Eric Sunshine Subject: [PATCH v4 04/39] t3404: prepare 'short SHA-1 collision' tests for SHA-256 Date: Sun, 26 Jul 2020 19:53:49 +0000 Message-Id: <20200726195424.626969-5-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.28.0.rc2.160.gd0b3904b262 In-Reply-To: <20200726195424.626969-1-sandals@crustytoothpaste.net> References: <20200726195424.626969-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