From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 2B1F81F8DB for ; Sun, 26 Jul 2020 19:55:00 +0000 (UTC) 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 Content-Transfer-Encoding: 8bit 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