From patchwork Sat Oct 5 21:11:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175853 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 96FA816B1 for ; Sat, 5 Oct 2019 21:12:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75613222C8 for ; Sat, 5 Oct 2019 21:12:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="UItvoaee" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726078AbfJEVMR (ORCPT ); Sat, 5 Oct 2019 17:12:17 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36290 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726038AbfJEVMR (ORCPT ); Sat, 5 Oct 2019 17:12:17 -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 DE50B61C61; Sat, 5 Oct 2019 21:12:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309936; bh=raAhS3PrnzvOKKvzy4YPRvhsXXlEiiTAXRPjU4RjW6c=; 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=UItvoaeeNCkyw33EXaUvcTlLMb/aLkSK+OlXSdyOqLI+JMW0b+7DT4DSwsu8YviOy r9IRYTWVQfN+Nb1F9y7lfsrBpq/bzVIb3VikQOUBGRcVJJo440aM3VpQMaxehZErHn aRE7qPRcnWdLh5xb2jQBB62r1963yxSP0WwxNhsgab09lZ9/ErGuWFF0K0boq9SF83 ct8KuCViv+vcKRoyVEW3t7ivv9UZWbQNFZT/P3cPFnRosHVrf7VSRPPCyhYrLGmTKa mWDZRzNAOHLWzceq/xgcgqEP6QND31s+IImLQeFElICPEYuvnKf9ihJzfRamiC2WVs JzBxkgKO+oUaCOrEna1fPGp3XPJLd76RhcE+sIPYhYIbF61YECheXpRcs0rblcr28Z 3c+rwTyhcYdQwi5np6IgIRE81nRjMIy8N4UxD3ASbFt1yIZLwR2Oew3v/LECJCI8FV Lq6Zliy96fp6wrChaUHaWgBvx3Dnx6m284d3N/fN4W7crYXe2qJ From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 01/15] t/oid-info: allow looking up hash algorithm name Date: Sat, 5 Oct 2019 21:11:55 +0000 Message-Id: <20191005211209.18237-2-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 test_oid function provides a mechanism for looking up hash algorithm information, but it doesn't specify a way to discover the hash algorithm name. Knowing this information is useful if one wants to invoke the test-tool helper for the algorithm in use, such as in our pack generation library. While it's currently possible to inspect the global variable holding this value, in the future we'll allow specifying an algorithm for storage and an algorithm for display, so it's better to abstract this value away. To assist with this, provide a named entry in the algorithm-specific lookup table that prints the algorithm in use. Signed-off-by: brian m. carlson --- t/oid-info/hash-info | 3 +++ 1 file changed, 3 insertions(+) diff --git a/t/oid-info/hash-info b/t/oid-info/hash-info index ccdbfdf974..6b5ded0b34 100644 --- a/t/oid-info/hash-info +++ b/t/oid-info/hash-info @@ -6,3 +6,6 @@ hexsz sha256:64 zero sha1:0000000000000000000000000000000000000000 zero sha256:0000000000000000000000000000000000000000000000000000000000000000 + +algo sha1:sha1 +algo sha256:sha256 From patchwork Sat Oct 5 21:11:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175855 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 CB6951902 for ; Sat, 5 Oct 2019 21:12:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A054F222C8 for ; Sat, 5 Oct 2019 21:12:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="xkZywuwl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726081AbfJEVMS (ORCPT ); Sat, 5 Oct 2019 17:12:18 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36296 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbfJEVMR (ORCPT ); Sat, 5 Oct 2019 17:12:17 -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 6588A61C62; Sat, 5 Oct 2019 21:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309936; bh=kTsu/KkPU5uz+yUbxqOEEb5PQfKnr0zRi+ykxEt3e/E=; 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=xkZywuwlv5uAsu4e9+PUQD8YEm4RDcILFa9B23VV957blwvMGfpX5S4EIqRcvtjth 8eYs1YRsxiWR+Q8G7eqW1T5UFuR/Zqxlqhpp5KngdEpMprodr89fu1RjmSMp7RcyKo 6cT49u380tOijRak24N5D+h2c/EPH2qjl6mTPBvKFVqfDNytxe/kU3bOfS+KhlXGXK vOv0+iFvyoEelUE0lR1w7qPmV8fWHcypez1ovkd7SxNlTNPAyJKlpGZiyvYZOdrtsK MZAQ6FA9GzYXgpiUm8BiqBTp6EbbOKS9ko7FtYFF0UneWeM31h+KgdFxc8WGglULTb 98ifjBurYnAYXLNdbapYO6CfOoQKGNZ97c7+xXI42AP/XF2e43WtJGvoGRikLCvKfe 5VuVi+lzNrhikdACjulaueBuY7uFCuLyWeH4vUjBi3e5MhNfD/JULVcGkO0UxJ2BAN KxPfU4ldWBlvn/K0xI7wO7VeI42peO6mxrX1YKVJ1sRk/iSD2DN From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 02/15] t/oid-info: add empty tree and empty blob values Date: Sat, 5 Oct 2019 21:11:56 +0000 Message-Id: <20191005211209.18237-3-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 testsuite will eventually learn how to run using an algorithm other than SHA-1. In preparation for this, teach the test_oid family of functions how to look up the empty blob and empty tree values so they can be used. Signed-off-by: brian m. carlson --- t/oid-info/hash-info | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/t/oid-info/hash-info b/t/oid-info/hash-info index 6b5ded0b34..d0736dd1a0 100644 --- a/t/oid-info/hash-info +++ b/t/oid-info/hash-info @@ -9,3 +9,9 @@ zero sha256:0000000000000000000000000000000000000000000000000000000000000000 algo sha1:sha1 algo sha256:sha256 + +empty_blob sha1:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 +empty_blob sha256:473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813 + +empty_tree sha1:4b825dc642cb6eb9a060e54bf8d69288fbee4904 +empty_tree sha256:6ef19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321 From patchwork Sat Oct 5 21:11:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175867 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 00E5D1902 for ; Sat, 5 Oct 2019 21:12:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D38D8222C8 for ; Sat, 5 Oct 2019 21:12:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="zEzx1uLt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726089AbfJEVMT (ORCPT ); Sat, 5 Oct 2019 17:12:19 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36302 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbfJEVMS (ORCPT ); Sat, 5 Oct 2019 17:12:18 -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 E228161C63; Sat, 5 Oct 2019 21:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309937; bh=oj6Hsyz93EL/63WPIe805Aute2VrMB6kGlSkslSoLTY=; 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=zEzx1uLtK38HIeB90jmRcLVeycMmPfowj4AliP27wxkGzHYhyPYYyTrkmpwOKuxU7 C+OpRqpfOOG3wGwRyNvDR9ZHeMDu1ZmL+W4oNx4tsOHmySrp+awu/vDjlKslyC8VZK Hj7rk6Y98yqMJH3DyHvkO5OmTnSvfPevaCGLQvFejeYGTJOUnjfMFJz0f0vMSuHmud uaFqvSkopB6A1wdV+X565T2yzvcaSrLyPX/dLpIeoEpr+jOASPM57/5LxCzj3sAgQ5 rv79ANzD9Mi5VKbVCASK1xSIutfsfrVINuX98Q0AN8LAveSUJs6O1giWuJgFbIezM9 n82lwSpAo+iaz4YSFbkoGYtVA6liLrsKizzyyLLJ5RYeA2ELALcOLkeI+8ZuiX9hxs qV0EKT45ai3RPb5Ye5Rurx7DTsKevNrKeHRJcE3rk4FpxlzXfPcyIjGkGJ3rIM3VLc bPKc9+PTSCQ/nyADFJuSWAgXj6xjCMonhpRtmUezu/e9B4GNGnz From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 03/15] rev-parse: add an --object-format option Date: Sat, 5 Oct 2019 21:11:57 +0000 Message-Id: <20191005211209.18237-4-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 Add an option to print the object format used for input, output, or storage. This allows shell scripts to discover the hash algorithm in use. Since the transition plan allows for multiple input algorithms, document that we may provide multiple results for input, and the format that the results may take. While we don't support this now, documenting it early means that script authors can future-proof their scripts for when we do. Signed-off-by: brian m. carlson --- Documentation/git-rev-parse.txt | 7 +++++++ builtin/rev-parse.c | 11 +++++++++++ t/t1500-rev-parse.sh | 15 +++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index e72d332b83..8a72190940 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -274,6 +274,13 @@ print a message to stderr and exit with nonzero status. Show the path to the shared index file in split index mode, or empty if not in split-index mode. +--object-format[=(storage|input|output)]:: + Show the object format (hash algorithm) used for the repository + for storage inside the `.git` directory, input, or output. For + input, multiple algorithms may be printed, space-separated. + If not specified, the default is "storage". + + Other Options ~~~~~~~~~~~~~ diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index f8bbe6d47e..8036219921 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -918,6 +918,17 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) show_datestring("--min-age=", arg); continue; } + if (opt_with_value(arg, "--object-format", &arg)) { + const char *val = arg ? arg : "storage"; + + if (strcmp(val, "storage") && + strcmp(val, "input") && + strcmp(val, "output")) + die("unknown mode for --object-format: %s", + arg); + puts(the_hash_algo->name); + continue; + } if (show_flag(arg) && verify) die_no_single_rev(quiet); continue; diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh index 01abee533d..fb3d81df4c 100755 --- a/t/t1500-rev-parse.sh +++ b/t/t1500-rev-parse.sh @@ -59,6 +59,7 @@ test_rev_parse () { ROOT=$(pwd) test_expect_success 'setup' ' + test_oid_init && mkdir -p sub/dir work && cp -R .git repo.git ' @@ -131,6 +132,20 @@ test_expect_success 'rev-parse --is-shallow-repository in non-shallow repo' ' test_cmp expect actual ' +test_expect_success 'rev-parse --object-format in repo' ' + echo "$(test_oid algo)" >expect && + git rev-parse --object-format >actual && + test_cmp expect actual && + git rev-parse --object-format=storage >actual && + test_cmp expect actual && + git rev-parse --object-format=input >actual && + test_cmp expect actual && + git rev-parse --object-format=output >actual && + test_cmp expect actual && + test_must_fail git rev-parse --object-format=squeamish-ossifrage 2>err && + grep "unknown mode for --object-format: squeamish-ossifrage" err +' + test_expect_success 'showing the superproject correctly' ' git rev-parse --show-superproject-working-tree >out && test_must_be_empty out && From patchwork Sat Oct 5 21:11:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175859 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 173501902 for ; Sat, 5 Oct 2019 21:12:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E0625222C8 for ; Sat, 5 Oct 2019 21:12:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="FWkqupTV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726097AbfJEVMT (ORCPT ); Sat, 5 Oct 2019 17:12:19 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36304 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbfJEVMS (ORCPT ); Sat, 5 Oct 2019 17:12:18 -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 68F5161C64; Sat, 5 Oct 2019 21:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309937; bh=HEAARVq6WzbSWTtAFWhDdK2BPOqm0jEDt49JPJTdq10=; 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=FWkqupTVwW63Xr+/rhe8MnajsknLdBmidyZoYlWDClgBnYx/m+3XX2Rudwwr08OzH BQFXEgETwY0LS0OSHIb//yFci0YMjlQjuuS0yFKpAZ1ztjmoEbvlB/KOEITKfQMB0M fpFzUn1HweCib2Bci6G0jBoOjqme5nfCtRVViGwvHUoBLZiDslmTwK3MxZDdRiUUJd fj/rV6gYSsq4ZpmIVnB2RlXMKtccTo1w5IK9s+jhXDf2fXAvYdycbiU2Cy6bZZJFFS VgY1XtKh0/P5kQNp9fXHcJd//2xr2fQOvlcfHj9RJMqcOPEUKXzhdeGksyvx++8mOW ANmp1oPCq64AnFSK5ejJ6Ztb4xcO0z4uNbaV5KeILgRanXfvj3sNAd82yCkwdjukhw o8rj/uLJbO4K0MupuKcwAMbI15GomLOFqwFuxSrKeR4pgF0sCKJ7n1qGf1MPy3jdDY iar2Ry6kY++xR143a59+MGdSC1V3Y7A8EoMqTGFGBu5G/qXTm/9 From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 04/15] t1305: avoid comparing extensions Date: Sat, 5 Oct 2019 21:11:58 +0000 Message-Id: <20191005211209.18237-5-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 A repository using a hash other than SHA-1 will need to have an extension in the config file. Ignore any extensions when comparing config files, since they don't usefully contribute to the goal of the test. Signed-off-by: brian m. carlson --- t/t1305-config-include.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh index d20b4d150d..f1e1b289f9 100755 --- a/t/t1305-config-include.sh +++ b/t/t1305-config-include.sh @@ -63,7 +63,7 @@ test_expect_success 'listing includes option and expansion' ' test.one=1 EOF git config --list >actual.full && - grep -v ^core actual.full >actual && + grep -v -e ^core -e ^extensions actual.full >actual && test_cmp expect actual ' From patchwork Sat Oct 5 21:11:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175861 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 720C776 for ; Sat, 5 Oct 2019 21:12:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 46C3B222C8 for ; Sat, 5 Oct 2019 21:12:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="j3NsgU35" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726102AbfJEVMT (ORCPT ); Sat, 5 Oct 2019 17:12:19 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36310 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726084AbfJEVMT (ORCPT ); Sat, 5 Oct 2019 17:12:19 -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 15EB661C61; Sat, 5 Oct 2019 21:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309938; bh=Wm52b8iIB9lXyIl7tICfuaKE4juYijcTOcHsmgsONd8=; 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=j3NsgU35mqpCrJEJxnvbcGAWyrA4yYjLhcUyPW4ooTVdTJ5ZdfX6X0jVqUbenNVOH c6qUtgSwYqCpolv33tg67oZp6iiIXfeYexOOMgLIhS17dexFsL9w3WX023/k2jVoWZ R6rcWu/cHqymUSeOgn0kMl2hF56pEU3X4kxLbZs/ru+2mXFRpilOE2QVwugA6uLMqp /+HepqiJsngFFUuFg9pgikFrNTfjSuTeuJCDVFp72Z+tEZnWPG3YACBkQyGaC6j8N2 3U/mfJo/eYHlpPhgSwDEF+qVuhMvbD3nFcD6n3mtquWpxDhJqJw4y0Q8EdQ8k45pSC whkede6Tz/sNScTlmVcki+9ud21Hm6NMDGEH9Bdv7kIkVWIztjZk76Sj6CjlAQRgwR qntWugskr9aFb6VS00trc0KOWX6Rq9KRZMeZ+9G6yYRrSRR3ybWrJvsfF8d6JGbNRd +b2OhHtflaLlSpQdqoyuBhZ57ALCwqdodFJsuyWwxOnsSrjow09 From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 05/15] t3429: remove SHA1 annotation Date: Sat, 5 Oct 2019 21:11:59 +0000 Message-Id: <20191005211209.18237-6-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 This test passes successfully with SHA-256, so remove the annotation which limits it to SHA-1. Signed-off-by: brian m. carlson --- t/t3429-rebase-edit-todo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t3429-rebase-edit-todo.sh b/t/t3429-rebase-edit-todo.sh index 76f6d306ea..63edf17114 100755 --- a/t/t3429-rebase-edit-todo.sh +++ b/t/t3429-rebase-edit-todo.sh @@ -11,7 +11,7 @@ test_expect_success 'rebase exec modifies rebase-todo' ' test -e F ' -test_expect_success SHA1 'loose object cache vs re-reading todo list' ' +test_expect_success 'loose object cache vs re-reading todo list' ' GIT_REBASE_TODO=.git/rebase-merge/git-rebase-todo && export GIT_REBASE_TODO && write_script append-todo.sh <<-\EOS && From patchwork Sat Oct 5 21:12:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175869 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 1BC7876 for ; Sat, 5 Oct 2019 21:12:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EE45E222C0 for ; Sat, 5 Oct 2019 21:12:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="yXnpYYpn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726128AbfJEVMW (ORCPT ); Sat, 5 Oct 2019 17:12:22 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36304 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbfJEVMU (ORCPT ); Sat, 5 Oct 2019 17:12:20 -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 AAC8E61C65; Sat, 5 Oct 2019 21:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309939; bh=KtiT5CidkjsFlDXBaQ/DpJldMHEGdvP6U+ynpDTh+Y0=; 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=yXnpYYpnvoaGkIjAklH0IJfdaQwxJz+f9qLgIa8OlFHCSqvz1Acucr4bfTsJbtJ8A tqfbMcDlYduaIEZSDmmN55Gbczj+09haA5Lt2XC57Tl+eg/80PrAB8d9aK/wqZprRi bg5IegGSme34lDduJkOTwDvfoE4H1RNwR0nK1WRsR7tzJLMLeHNSV/p5gaZYvpY2hX zh6Np/FWAOATqMahC08Tp/r2deOCL0Ae4SwbZHjR06ZSAKaqDQ3x6LeY7dn6550sht FLPILadeHvGqchgj5NuSFn9Qaiuq8e7SM1lID8VKiIa494zwkNMApb8NUXZOVBjs9a +RgB05VLTKbmrVbjPd5IiCY1SLk1sbLstEJPNjRk+cU+U5U0bUvPThKGoTh1ulW3/7 cEME/rD2QLwzQeFkDl3lq0N5DlpxJhgVEuOiWzkcFTsBF4qczFllJt6r/tLoLtBXuw H3IALAvi4HMPOJEQbFdFA2PQxN6Xftu36tcSN2vNJm93dDAyeLR From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 06/15] t4010: abstract away SHA-1-specific constants Date: Sat, 5 Oct 2019 21:12:00 +0000 Message-Id: <20191005211209.18237-7-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 Adjust the test so that it computes variables for object IDs instead of using hard-coded hashes. Signed-off-by: brian m. carlson --- t/t4010-diff-pathspec.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh index 281f8fad0c..e5ca359edf 100755 --- a/t/t4010-diff-pathspec.sh +++ b/t/t4010-diff-pathspec.sh @@ -17,11 +17,15 @@ test_expect_success \ 'echo frotz >file0 && mkdir path1 && echo rezrov >path1/file1 && + before0=$(git hash-object file0) && + before1=$(git hash-object path1/file1) && git update-index --add file0 path1/file1 && tree=$(git write-tree) && echo "$tree" && echo nitfol >file0 && echo yomin >path1/file1 && + after0=$(git hash-object file0) && + after1=$(git hash-object path1/file1) && git update-index file0 path1/file1' cat >expected <<\EOF @@ -31,32 +35,32 @@ test_expect_success \ 'git diff-index --cached $tree -- path >current && compare_diff_raw current expected' -cat >expected <<\EOF -:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1 +cat >expected <current && compare_diff_raw current expected' -cat >expected <<\EOF -:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1 +cat >expected <current && compare_diff_raw current expected' -cat >expected <<\EOF -:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1 +cat >expected <current && compare_diff_raw current expected' -cat >expected <<\EOF -:100644 100644 8e4020bb5a8d8c873b25de15933e75cc0fc275df dca6b92303befc93086aa025d90a5facd7eb2812 M file0 +cat >expected < X-Patchwork-Id: 11175863 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 B873076 for ; Sat, 5 Oct 2019 21:12:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 97802222C8 for ; Sat, 5 Oct 2019 21:12:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="VIPg7Ool" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726107AbfJEVMU (ORCPT ); Sat, 5 Oct 2019 17:12:20 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36302 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbfJEVMU (ORCPT ); Sat, 5 Oct 2019 17:12:20 -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 32D5161C63; Sat, 5 Oct 2019 21:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309939; bh=R1peGq3gHTVqQyCMrxtvF/BhGK1RjhCO4LktLfzNJmA=; 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=VIPg7Ool23uiJESTzFWjcnQZb79HBGaQEAkAFLTmAdGt9zUd7TJE/+7pWw37XOYdX 2hyzMkeQjzGanfZim1TzoacMyVR5qBkHWYsaM/67z4rK/x+6YU8GVYLORh3BwgUVKO eATX4PSkedWvuGmOy2C7/U/uz3qTzYCO8bMkw6oBIwAjRdZ6BUXrFXOWPRPMJT7N+S NcNU69JtPnbMIAIYAOeKg5ZUBD7dXR3Xot0OnA8QSReM6XuaGrwMJMFYjYJ9Ft62AJ 6bhZ1ZaWjY8QtKEcgp9L4xdPPO9XH9Ae22nhdb7nHzTOMxubv20eE1FUlZhJOrixJH O+chE331FYTsOuql+2UgiB5LxdwLKLQWIkOOUHlRM2I5dSwjwE+Coyw5abuEdchBuQ AcgMa0va+fh8jogxu++pRAldYMRAcJFGXjP6+6NI8w5z7plfamvjmPsFFcYBzAQdFH P7Do+sdFOtzYAk1DSBjCUaRuWCWfD42u7gwGm6lDIEzvNOm/Kj7 From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 07/15] t4011: abstract away SHA-1-specific constants Date: Sat, 5 Oct 2019 21:12:01 +0000 Message-Id: <20191005211209.18237-8-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 Adjust the test so that it computes variables for object IDs instead of using hard-coded hashes. Signed-off-by: brian m. carlson --- t/t4011-diff-symlink.sh | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh index 5ae19b987d..b6934da266 100755 --- a/t/t4011-diff-symlink.sh +++ b/t/t4011-diff-symlink.sh @@ -10,10 +10,12 @@ test_description='Test diff of symlinks. . "$TEST_DIRECTORY"/diff-lib.sh test_expect_success 'diff new symlink and file' ' - cat >expected <<-\EOF && + symlink=$(git rev-parse --short \ + $(printf xyzzy | git hash-object --stdin)) && + cat >expected <<-EOF && diff --git a/frotz b/frotz new file mode 120000 - index 0000000..7c465af + index 0000000..$symlink --- /dev/null +++ b/frotz @@ -0,0 +1 @@ @@ -21,7 +23,7 @@ test_expect_success 'diff new symlink and file' ' \ No newline at end of file diff --git a/nitfol b/nitfol new file mode 100644 - index 0000000..7c465af + index 0000000..$symlink --- /dev/null +++ b/nitfol @@ -0,0 +1 @@ @@ -46,10 +48,10 @@ test_expect_success 'diff unchanged symlink and file' ' ' test_expect_success 'diff removed symlink and file' ' - cat >expected <<-\EOF && + cat >expected <<-EOF && diff --git a/frotz b/frotz deleted file mode 120000 - index 7c465af..0000000 + index $symlink..0000000 --- a/frotz +++ /dev/null @@ -1 +0,0 @@ @@ -57,7 +59,7 @@ test_expect_success 'diff removed symlink and file' ' \ No newline at end of file diff --git a/nitfol b/nitfol deleted file mode 100644 - index 7c465af..0000000 + index $symlink..0000000 --- a/nitfol +++ /dev/null @@ -1 +0,0 @@ @@ -90,9 +92,11 @@ test_expect_success 'diff identical, but newly created symlink and file' ' ' test_expect_success 'diff different symlink and file' ' - cat >expected <<-\EOF && + new=$(git rev-parse --short \ + $(printf yxyyz | git hash-object --stdin)) && + cat >expected <<-EOF && diff --git a/frotz b/frotz - index 7c465af..df1db54 120000 + index $symlink..$new 120000 --- a/frotz +++ b/frotz @@ -1 +1 @@ @@ -101,7 +105,7 @@ test_expect_success 'diff different symlink and file' ' +yxyyz \ No newline at end of file diff --git a/nitfol b/nitfol - index 7c465af..df1db54 100644 + index $symlink..$new 100644 --- a/nitfol +++ b/nitfol @@ -1 +1 @@ @@ -137,14 +141,17 @@ test_expect_success SYMLINKS 'setup symlinks with attributes' ' ' test_expect_success SYMLINKS 'symlinks do not respect userdiff config by path' ' - cat >expect <<-\EOF && + file=$(git rev-parse --short $(git hash-object file.bin)) && + link=$(git rev-parse --short \ + $(printf file.bin | git hash-object --stdin)) && + cat >expect <<-EOF && diff --git a/file.bin b/file.bin new file mode 100644 - index 0000000..d95f3ad + index 0000000..$file Binary files /dev/null and b/file.bin differ diff --git a/link.bin b/link.bin new file mode 120000 - index 0000000..dce41ec + index 0000000..$link --- /dev/null +++ b/link.bin @@ -0,0 +1 @@ From patchwork Sat Oct 5 21:12:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175865 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 8644276 for ; Sat, 5 Oct 2019 21:12:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5214F222C8 for ; Sat, 5 Oct 2019 21:12:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="FmkqQujZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726116AbfJEVMV (ORCPT ); Sat, 5 Oct 2019 17:12:21 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36310 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726084AbfJEVMV (ORCPT ); Sat, 5 Oct 2019 17:12:21 -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 AF32E61C64; Sat, 5 Oct 2019 21:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309940; bh=9cHS+BdocZDusjgmfDKsZP7OczLxO50sQOp48s48Hg0=; 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=FmkqQujZahuvkaMMUvsTtfrRDVmsKVhD8ZzJI8saQ8wCQg8hLSb6z9g1Kyuhpqfcf uw/DfCg8IkfADz0JD0P7yHoyRFjqMbB714AnXh734F+0/mL0y3+tYpGNJhM/GwbKXo Dx2+QZVvu93LH/7b1Rqu0rVVAegAENTqCXkri76qrxFkuox9s2NotgrgWzvdiQ20CR HZuAClIKEzC4KRH1RGrMsALlYRaF5hlvlhyJB+gSAQzVu3TYoiWZ34P7mZFuK4ZEGc U5upBwBR0fox2qJaOyJWcHDvdo9XrnfetHpoBJUDRrXR0VkWBmvpgw8GdxTRcYdg5p WagIFnkz38MIPXuJYzu/P+uij+P7wHQMjKHlwBJBil5ieNeAR0e6n40aZQo3KWsVkv nsjH0WGPLyejwUpjoJty2rlg+RJIB8/bNdgkmi5FTPmUDciEU2M3x9EF4g2usNeJlh 2JiBUUoN6llVmaH+YBEu6l0iIQ2YibrSGgmU0CMkG0qxP/9jbJl From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 08/15] t4015: abstract away SHA-1-specific constants Date: Sat, 5 Oct 2019 21:12:02 +0000 Message-Id: <20191005211209.18237-9-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 Adjust the test so that it computes variables for object IDs instead of using hard-coded hashes. Signed-off-by: brian m. carlson --- t/t4015-diff-whitespace.sh | 89 +++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 36 deletions(-) diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index 6b087df3dc..eadaf57262 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -16,6 +16,7 @@ test_expect_success "Ray Lehtiniemi's example" ' } while (0); EOF git update-index --add x && + before=$(git rev-parse --short $(git hash-object x)) && cat <<-\EOF >x && do @@ -24,10 +25,11 @@ test_expect_success "Ray Lehtiniemi's example" ' } while (0); EOF + after=$(git rev-parse --short $(git hash-object x)) && - cat <<-\EOF >expect && + cat <<-EOF >expect && diff --git a/x b/x - index adf3937..6edc172 100644 + index $before..$after 100644 --- a/x +++ b/x @@ -1,3 +1,5 @@ @@ -61,6 +63,7 @@ test_expect_success 'another test, without options' ' EOF git update-index x && + before=$(git rev-parse --short $(git hash-object x)) && tr "_" " " <<-\EOF >x && _ whitespace at beginning @@ -70,10 +73,11 @@ test_expect_success 'another test, without options' ' unchanged line CR at end EOF + after=$(git rev-parse --short $(git hash-object x)) && - tr "Q_" "\015 " <<-\EOF >expect && + tr "Q_" "\015 " <<-EOF >expect && diff --git a/x b/x - index d99af23..22d9f73 100644 + index $before..$after 100644 --- a/x +++ b/x @@ -1,6 +1,6 @@ @@ -108,9 +112,9 @@ test_expect_success 'another test, without options' ' git diff -w --ignore-cr-at-eol >out && test_must_be_empty out && - tr "Q_" "\015 " <<-\EOF >expect && + tr "Q_" "\015 " <<-EOF >expect && diff --git a/x b/x - index d99af23..22d9f73 100644 + index $before..$after 100644 --- a/x +++ b/x @@ -1,6 +1,6 @@ @@ -132,9 +136,9 @@ test_expect_success 'another test, without options' ' git diff -b --ignore-cr-at-eol >out && test_cmp expect out && - tr "Q_" "\015 " <<-\EOF >expect && + tr "Q_" "\015 " <<-EOF >expect && diff --git a/x b/x - index d99af23..22d9f73 100644 + index $before..$after 100644 --- a/x +++ b/x @@ -1,6 +1,6 @@ @@ -154,9 +158,9 @@ test_expect_success 'another test, without options' ' git diff --ignore-space-at-eol --ignore-cr-at-eol >out && test_cmp expect out && - tr "Q_" "\015 " <<-\EOF >expect && + tr "Q_" "\015 " <<-EOF >expect && diff --git a/x b/x - index_d99af23..22d9f73 100644 + index_$before..$after 100644 --- a/x +++ b/x @@ -1,6 +1,6 @@ @@ -786,23 +790,25 @@ test_expect_success 'whitespace-only changes not reported' ' test_must_be_empty actual ' -cat <expect -diff --git a/x b/z -similarity index NUM% -rename from x -rename to z -index 380c32a..a97b785 100644 -EOF test_expect_success 'whitespace-only changes reported across renames' ' git reset --hard && for i in 1 2 3 4 5 6 7 8 9; do echo "$i$i$i$i$i$i"; done >x && git add x && + before=$(git rev-parse --short $(git hash-object x)) && git commit -m "base" && sed -e "5s/^/ /" x >z && git rm x && git add z && + after=$(git rev-parse --short $(git hash-object z)) && git diff -w -M --cached | sed -e "/^similarity index /s/[0-9][0-9]*/NUM/" >actual && + cat <<-EOF >expect && + diff --git a/x b/z + similarity index NUM% + rename from x + rename to z + index $before..$after 100644 + EOF test_cmp expect actual ' @@ -858,13 +864,15 @@ test_expect_success 'diff that introduces a line with only tabs' ' git config core.whitespace blank-at-eol && git reset --hard && echo "test" >x && + before=$(git rev-parse --short $(git hash-object x)) && git commit -m "initial" x && echo "{NTN}" | tr "NT" "\n\t" >>x && + after=$(git rev-parse --short $(git hash-object x)) && git diff --color | test_decode_color >current && - cat >expected <<-\EOF && + cat >expected <<-EOF && diff --git a/x b/x - index 9daeafb..2874b91 100644 + index $before..$after 100644 --- a/x +++ b/x @@ -1 +1,4 @@ @@ -883,19 +891,21 @@ test_expect_success 'diff that introduces and removes ws breakages' ' echo "0. blank-at-eol " && echo "1. blank-at-eol " } >x && + before=$(git rev-parse --short $(git hash-object x)) && git commit -a --allow-empty -m preimage && { echo "0. blank-at-eol " && echo "1. still-blank-at-eol " && echo "2. and a new line " } >x && + after=$(git rev-parse --short $(git hash-object x)) && git diff --color | test_decode_color >current && - cat >expected <<-\EOF && + cat >expected <<-EOF && diff --git a/x b/x - index d0233a2..700886e 100644 + index $before..$after 100644 --- a/x +++ b/x @@ -1,2 +1,3 @@ @@ -915,16 +925,18 @@ test_expect_success 'ws-error-highlight test setup' ' echo "0. blank-at-eol " && echo "1. blank-at-eol " } >x && + before=$(git rev-parse --short $(git hash-object x)) && git commit -a --allow-empty -m preimage && { echo "0. blank-at-eol " && echo "1. still-blank-at-eol " && echo "2. and a new line " } >x && + after=$(git rev-parse --short $(git hash-object x)) && - cat >expect.default-old <<-\EOF && + cat >expect.default-old <<-EOF && diff --git a/x b/x - index d0233a2..700886e 100644 + index $before..$after 100644 --- a/x +++ b/x @@ -1,2 +1,3 @@ @@ -934,9 +946,9 @@ test_expect_success 'ws-error-highlight test setup' ' +2. and a new line EOF - cat >expect.all <<-\EOF && + cat >expect.all <<-EOF && diff --git a/x b/x - index d0233a2..700886e 100644 + index $before..$after 100644 --- a/x +++ b/x @@ -1,2 +1,3 @@ @@ -946,9 +958,9 @@ test_expect_success 'ws-error-highlight test setup' ' +2. and a new line EOF - cat >expect.none <<-\EOF + cat >expect.none <<-EOF diff --git a/x b/x - index d0233a2..700886e 100644 + index $before..$after 100644 --- a/x +++ b/x @@ -1,2 +1,3 @@ @@ -1022,14 +1034,15 @@ test_expect_success 'detect moved code, complete file' ' EOF git add test.c && git commit -m "add main function" && + file=$(git rev-parse --short HEAD:test.c) && git mv test.c main.c && test_config color.diff.oldMoved "normal red" && test_config color.diff.newMoved "normal green" && git diff HEAD --color-moved=zebra --color --no-renames | test_decode_color >actual && - cat >expected <<-\EOF && + cat >expected <<-EOF && diff --git a/main.c b/main.c new file mode 100644 - index 0000000..a986c57 + index 0000000..$file --- /dev/null +++ b/main.c @@ -0,0 +1,5 @@ @@ -1040,7 +1053,7 @@ test_expect_success 'detect moved code, complete file' ' +} diff --git a/test.c b/test.c deleted file mode 100644 - index a986c57..0000000 + index $file..0000000 --- a/test.c +++ /dev/null @@ -1,5 +0,0 @@ @@ -1094,6 +1107,8 @@ test_expect_success 'detect malicious moved code, inside file' ' EOF git add main.c test.c && git commit -m "add main and test file" && + before_main=$(git rev-parse --short HEAD:main.c) && + before_test=$(git rev-parse --short HEAD:test.c) && cat <<-\EOF >main.c && #include int stuff() @@ -1126,10 +1141,12 @@ test_expect_success 'detect malicious moved code, inside file' ' bar(); } EOF + after_main=$(git rev-parse --short $(git hash-object main.c)) && + after_test=$(git rev-parse --short $(git hash-object test.c)) && git diff HEAD --no-renames --color-moved=zebra --color | test_decode_color >actual && - cat <<-\EOF >expected && + cat <<-EOF >expected && diff --git a/main.c b/main.c - index 27a619c..7cf9336 100644 + index $before_main..$after_main 100644 --- a/main.c +++ b/main.c @@ -5,13 +5,6 @@ printf("Hello "); @@ -1147,7 +1164,7 @@ test_expect_success 'detect malicious moved code, inside file' ' { foo(); diff --git a/test.c b/test.c - index 1dc1d85..2bedec9 100644 + index $before_test..$after_test 100644 --- a/test.c +++ b/test.c @@ -4,6 +4,13 @@ int bar() @@ -1176,9 +1193,9 @@ test_expect_success 'plain moved code, inside file' ' test_config color.diff.newMovedAlternative "yellow" && # needs previous test as setup git diff HEAD --no-renames --color-moved=plain --color | test_decode_color >actual && - cat <<-\EOF >expected && + cat <<-EOF >expected && diff --git a/main.c b/main.c - index 27a619c..7cf9336 100644 + index $before_main..$after_main 100644 --- a/main.c +++ b/main.c @@ -5,13 +5,6 @@ printf("Hello "); @@ -1196,7 +1213,7 @@ test_expect_success 'plain moved code, inside file' ' { foo(); diff --git a/test.c b/test.c - index 1dc1d85..2bedec9 100644 + index $before_test..$after_test 100644 --- a/test.c +++ b/test.c @@ -4,6 +4,13 @@ int bar() From patchwork Sat Oct 5 21:12:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175875 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 4564E16B1 for ; Sat, 5 Oct 2019 21:12:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24203222C0 for ; Sat, 5 Oct 2019 21:12:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="HNq4X0Sc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726157AbfJEVMY (ORCPT ); Sat, 5 Oct 2019 17:12:24 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36302 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbfJEVMV (ORCPT ); Sat, 5 Oct 2019 17:12:21 -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 52AF461C66; Sat, 5 Oct 2019 21:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309940; bh=w/+wbft3C9E50SobW5TLIelUCHgfvWYMz4HIcJUKMz0=; 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=HNq4X0ScZky8hUYuHd1O2q45JQvaVLlhwj+rBR9SGzjMKPtRH6zDfc7oG4Skc24WF 5RtkAuIbAYISt+azf1AXCtE4pE160gh4Klq0PGoUV73zD0GRYnwshamFbxvhIGJ3O5 fRRuKZrB3Jwys5F7gmdv6nYbbpJ+ElJ3ZRhbCEvV3UuHfXFGoDPDbaYwlv42GSU3fx Y7TvNrJyCN1oIjiR8hMdsoFX1yNc8sNy1KFCRpp+IIHh5CgeHKV9ZNkzN86RKOYOBW N/HGq8J55ktRZNeEghuhGBnlYhgCfqtZHQ8svIE8hSSZyC4n0YnsJHcLn7q28+btBE gbqXJSyI/+k3OlWzzT0Ena76eut3hMeS+GHbbMwwTwJQ6sQAQOtCwzovJDZ11qiZ0b grKZrw/y0SzLlHaOssyrJifWP4SlIKPiGXx6WbpbF7ijaOv2+SzR9NtAfxMXAOqaCY nsaImreFJb6fiRxakC8h7zO3ugNqOsivB5qMFQdMfLz8pMNFjRF From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 09/15] t4027: make hash-size independent Date: Sat, 5 Oct 2019 21:12:03 +0000 Message-Id: <20191005211209.18237-10-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 Instead of hard-coding the length of an object ID, look this value up using the translation tables. Similarly, compute input data for invalid submodule entries using the tables as well. Signed-off-by: brian m. carlson --- t/t4027-diff-submodule.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/t/t4027-diff-submodule.sh b/t/t4027-diff-submodule.sh index 9aa8e2b39b..e29deaf4a5 100755 --- a/t/t4027-diff-submodule.sh +++ b/t/t4027-diff-submodule.sh @@ -6,6 +6,7 @@ test_description='difference in submodules' . "$TEST_DIRECTORY"/diff-lib.sh test_expect_success setup ' + test_oid_init && test_tick && test_create_repo sub && ( @@ -36,7 +37,8 @@ test_expect_success setup ' ' test_expect_success 'git diff --raw HEAD' ' - git diff --raw --abbrev=40 HEAD >actual && + hexsz=$(test_oid hexsz) && + git diff --raw --abbrev=$hexsz HEAD >actual && test_cmp expect actual ' @@ -245,23 +247,21 @@ test_expect_success 'git diff (empty submodule dir)' ' ' test_expect_success 'conflicted submodule setup' ' - - # 39 efs - c=fffffffffffffffffffffffffffffffffffffff && + c=$(test_oid ff_1) && ( echo "000000 $ZERO_OID 0 sub" && echo "160000 1$c 1 sub" && echo "160000 2$c 2 sub" && echo "160000 3$c 3 sub" ) | git update-index --index-info && - echo >expect.nosub '\''diff --cc sub + echo >expect.nosub "diff --cc sub index 2ffffff,3ffffff..0000000 --- a/sub +++ b/sub @@@ -1,1 -1,1 +1,1 @@@ -- Subproject commit 2fffffffffffffffffffffffffffffffffffffff - -Subproject commit 3fffffffffffffffffffffffffffffffffffffff -++Subproject commit 0000000000000000000000000000000000000000'\'' && +- Subproject commit 2$c + -Subproject commit 3$c +++Subproject commit $ZERO_OID" && hh=$(git rev-parse HEAD) && sed -e "s/$ZERO_OID/$hh/" expect.nosub >expect.withsub From patchwork Sat Oct 5 21:12:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175881 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 8D8C016B1 for ; Sat, 5 Oct 2019 21:12:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 630F9222C8 for ; Sat, 5 Oct 2019 21:12:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="wkX8ItsS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726177AbfJEVM1 (ORCPT ); Sat, 5 Oct 2019 17:12:27 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36304 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726108AbfJEVMV (ORCPT ); Sat, 5 Oct 2019 17:12:21 -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 CCEC161C65; Sat, 5 Oct 2019 21:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309941; bh=qYenGaKPDZjYRksMpqhkwpFuFulBPHCDF0wPtaeFYNo=; 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=wkX8ItsSIa3sY+o4WXBPZBDmJfaYT6uKdSd79N4ujfGGG2gkOq0w2zwla4pzfuKyg 4GonnrbfotMOxtXVJ8joZXFvkewfropj8PppNQjMBw69/i3I1GGfg0ltsIzvU1GxNZ H6k6H3wcKN9Iyh7w6tatSt9wpcqZesVek5i4RsuBmX2F5raFDwCRvfqeloGvZ3+n02 v0OvZgCoZyeFLNuT8K08J2An6Z/Nb+XkJtj+9aiL6FDLg/Nn9b5RCq798997oe4vzG haD5GiYudUb5nSMdkQ6ozIR9O0GeV52hedLKlfnsOFJFeTGhafgNrGQra+hTedK8lJ E5YqoOI9EGOnrWzKTN2n5ZkUH9ZwSWJWXnXyxRcYx4e2DdCJwHhY3SSdGh40x2pEiq 0qSXbzjuhpEP0TiTUyqVXBCyx1gu2FVKeGR9jsOtp1OlQUzKdqLuG53yMrSGsNNSjv Q+e73YtwpHYGeT8vy6T6QpCPSmh1zS0t4QDbglSl23UaF9M++14 From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 10/15] t4034: abstract away SHA-1-specific constants Date: Sat, 5 Oct 2019 21:12:04 +0000 Message-Id: <20191005211209.18237-11-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 Adjust the test so that it computes variables for object IDs instead of using hard-coded hashes. Move some expected result heredocs around so that they can use computed variables. Signed-off-by: brian m. carlson --- t/t4034-diff-words.sh | 93 +++++++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 39 deletions(-) diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh index 9a93c2a3e0..fb145aa173 100755 --- a/t/t4034-diff-words.sh +++ b/t/t4034-diff-words.sh @@ -19,9 +19,11 @@ cat >post.simple <<-\EOF aeff = aeff * ( aaa ) EOF -cat >expect.letter-runs-are-words <<-\EOF +pre=$(git rev-parse --short $(git hash-object pre.simple)) +post=$(git rev-parse --short $(git hash-object post.simple)) +cat >expect.letter-runs-are-words <<-EOF diff --git a/pre b/post - index 330b04f..5ed8eff 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -33,9 +35,9 @@ cat >expect.letter-runs-are-words <<-\EOF aeff = aeff * ( aaa ) EOF -cat >expect.non-whitespace-is-word <<-\EOF +cat >expect.non-whitespace-is-word <<-EOF diff --git a/pre b/post - index 330b04f..5ed8eff 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -49,9 +51,12 @@ cat >expect.non-whitespace-is-word <<-\EOF EOF word_diff () { + pre=$(git rev-parse --short $(git hash-object pre)) && + post=$(git rev-parse --short $(git hash-object post)) && test_must_fail git diff --no-index "$@" pre post >output && test_decode_color output.decrypted && - test_cmp expect output.decrypted + sed -e "2s/index [^ ]*/index $pre..$post/" expect >expected + test_cmp expected output.decrypted } test_language_driver () { @@ -77,9 +82,9 @@ test_expect_success 'set up pre and post with runs of whitespace' ' ' test_expect_success 'word diff with runs of whitespace' ' - cat >expect <<-\EOF && + cat >expect <<-EOF && diff --git a/pre b/post - index 330b04f..5ed8eff 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -97,9 +102,9 @@ test_expect_success 'word diff with runs of whitespace' ' ' test_expect_success '--word-diff=porcelain' ' - sed 's/#.*$//' >expect <<-\EOF && + sed 's/#.*$//' >expect <<-EOF && diff --git a/pre b/post - index 330b04f..5ed8eff 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -121,9 +126,9 @@ test_expect_success '--word-diff=porcelain' ' ' test_expect_success '--word-diff=plain' ' - cat >expect <<-\EOF && + cat >expect <<-EOF && diff --git a/pre b/post - index 330b04f..5ed8eff 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -140,9 +145,9 @@ test_expect_success '--word-diff=plain' ' ' test_expect_success '--word-diff=plain --color' ' - cat >expect <<-\EOF && + cat >expect <<-EOF && diff --git a/pre b/post - index 330b04f..5ed8eff 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -158,9 +163,9 @@ test_expect_success '--word-diff=plain --color' ' ' test_expect_success 'word diff without context' ' - cat >expect <<-\EOF && + cat >expect <<-EOF && diff --git a/pre b/post - index 330b04f..5ed8eff 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1 +1 @@ @@ -207,9 +212,9 @@ test_expect_success 'command-line overrides config' ' ' test_expect_success 'command-line overrides config: --word-diff-regex' ' - cat >expect <<-\EOF && + cat >expect <<-EOF && diff --git a/pre b/post - index 330b04f..5ed8eff 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -234,9 +239,9 @@ test_expect_success 'setup: remove diff driver regex' ' ' test_expect_success 'use configured regex' ' - cat >expect <<-\EOF && + cat >expect <<-EOF && diff --git a/pre b/post - index 330b04f..5ed8eff 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1,3 +1,7 @@ @@ -254,9 +259,11 @@ test_expect_success 'use configured regex' ' test_expect_success 'test parsing words for newline' ' echo "aaa (aaa)" >pre && echo "aaa (aaa) aaa" >post && - cat >expect <<-\EOF && + pre=$(git rev-parse --short $(git hash-object pre)) && + post=$(git rev-parse --short $(git hash-object post)) && + cat >expect <<-EOF && diff --git a/pre b/post - index c29453b..be22f37 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1 +1 @@ @@ -268,9 +275,11 @@ test_expect_success 'test parsing words for newline' ' test_expect_success 'test when words are only removed at the end' ' echo "(:" >pre && echo "(" >post && - cat >expect <<-\EOF && + pre=$(git rev-parse --short $(git hash-object pre)) && + post=$(git rev-parse --short $(git hash-object post)) && + cat >expect <<-EOF && diff --git a/pre b/post - index 289cb9d..2d06f37 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1 +1 @@ @@ -282,9 +291,11 @@ test_expect_success 'test when words are only removed at the end' ' test_expect_success '--word-diff=none' ' echo "(:" >pre && echo "(" >post && - cat >expect <<-\EOF && + pre=$(git rev-parse --short $(git hash-object pre)) && + post=$(git rev-parse --short $(git hash-object post)) && + cat >expect <<-EOF && diff --git a/pre b/post - index 289cb9d..2d06f37 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1 +1 @@ @@ -317,16 +328,6 @@ test_language_driver ruby test_language_driver tex test_expect_success 'word-diff with diff.sbe' ' - cat >expect <<-\EOF && - diff --git a/pre b/post - index a1a53b5..bc8fe6d 100644 - --- a/pre - +++ b/post - @@ -1,3 +1,3 @@ - a - - [-b-]{+c+} - EOF cat >pre <<-\EOF && a @@ -337,21 +338,35 @@ test_expect_success 'word-diff with diff.sbe' ' c EOF + pre=$(git rev-parse --short $(git hash-object pre)) && + post=$(git rev-parse --short $(git hash-object post)) && + cat >expect <<-EOF && + diff --git a/pre b/post + index $pre..$post 100644 + --- a/pre + +++ b/post + @@ -1,3 +1,3 @@ + a + + [-b-]{+c+} + EOF test_config diff.suppress-blank-empty true && word_diff --word-diff=plain ' test_expect_success 'word-diff with no newline at EOF' ' - cat >expect <<-\EOF && + printf "%s" "a a a a a" >pre && + printf "%s" "a a ab a a" >post && + pre=$(git rev-parse --short $(git hash-object pre)) && + post=$(git rev-parse --short $(git hash-object post)) && + cat >expect <<-EOF && diff --git a/pre b/post - index 7bf316e..3dd0303 100644 + index $pre..$post 100644 --- a/pre +++ b/post @@ -1 +1 @@ a a [-a-]{+ab+} a a EOF - printf "%s" "a a a a a" >pre && - printf "%s" "a a ab a a" >post && word_diff --word-diff=plain ' From patchwork Sat Oct 5 21:12:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175871 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 764891902 for ; Sat, 5 Oct 2019 21:12:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 54172222C0 for ; Sat, 5 Oct 2019 21:12:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="UGQEnchf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726138AbfJEVMX (ORCPT ); Sat, 5 Oct 2019 17:12:23 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36310 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726084AbfJEVMW (ORCPT ); Sat, 5 Oct 2019 17:12: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 55B5F61C63; Sat, 5 Oct 2019 21:12:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309941; bh=r81OHTNdRZalvqaLHm4qnZRbzuBf11/N7jQZHWxMBqQ=; 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=UGQEnchfC8j3wYgGVBf6teQd0ta6Xumk5rpt/6wzVmi08QsucOaJXR/5oD2O7tiiw IUu2RDcRpomKOBB4oZacVBRbN8trow5HePQGSiZ8lDD5mHonZGiMGZD/GAbXITMQP4 HxOp/GtsgFLB1AcpRepCAK7TuXxFJE5yphG29JHYfi51Z0ISqxdVebWmbRnLyvSwNX zCmWRBy53pvR0Wk+n7zQVszAdWzLNCtk4A1CQ66Cd+BFHl54eQiSIwutdCqYCBJgVn IMZsUHDVEJX2ruaabmQaLNV0IB47CMMX/aN+ia2NtU86PO8PQjVjyOXsJyWBg2po7P vQzWKktg/WnqG554zooteZ50Daw9Vc/Zc+SyRAtLc9+mwSkmY5X4P8/kd3p2tJgKiE I6oAzseUoxyRv4SjEVwRqa0ioJdyx5vXlb+UMAsz53yf1pH0YZHUv/2f1iCXAoXt7D OzKXukR6ebahRYPcEJ5XtMdeRX7mZrgD4hr1PiIAjtvCgDqfGzR From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 11/15] t4038: abstract away SHA-1 specific constants Date: Sat, 5 Oct 2019 21:12:05 +0000 Message-Id: <20191005211209.18237-12-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 Compute several object IDs that exist in expected output, since we don't care about the specific object IDs, only that the format of the output is syntactically correct. Signed-off-by: brian m. carlson --- t/t4038-diff-combined.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/t/t4038-diff-combined.sh b/t/t4038-diff-combined.sh index d4afe12554..15fc054fdb 100755 --- a/t/t4038-diff-combined.sh +++ b/t/t4038-diff-combined.sh @@ -440,11 +440,13 @@ test_expect_success 'setup for --combined-all-paths' ' git branch side2c && git checkout side1c && test_seq 1 10 >filename-side1c && + side1cf=$(git hash-object filename-side1c) && git add filename-side1c && git commit -m with && git checkout side2c && test_seq 1 9 >filename-side2c && echo ten >>filename-side2c && + side2cf=$(git hash-object filename-side2c) && git add filename-side2c && git commit -m iam && git checkout -b mergery side1c && @@ -452,13 +454,14 @@ test_expect_success 'setup for --combined-all-paths' ' git rm filename-side1c && echo eleven >>filename-side2c && git mv filename-side2c filename-merged && + mergedf=$(git hash-object filename-merged) && git add filename-merged && git commit ' test_expect_success '--combined-all-paths and --raw' ' - cat <<-\EOF >expect && - ::100644 100644 100644 f00c965d8307308469e537302baa73048488f162 088bd5d92c2a8e0203ca8e7e4c2a5c692f6ae3f7 333b9c62519f285e1854830ade0fe1ef1d40ee1b RR filename-side1c filename-side2c filename-merged + cat <<-EOF >expect && + ::100644 100644 100644 $side1cf $side2cf $mergedf RR filename-side1c filename-side2c filename-merged EOF git diff-tree -c -M --raw --combined-all-paths HEAD >actual.tmp && sed 1d actual && @@ -482,11 +485,13 @@ test_expect_success FUNNYNAMES 'setup for --combined-all-paths with funny names' git checkout side1d && test_seq 1 10 >"$(printf "file\twith\ttabs")" && git add file* && + side1df=$(git hash-object *tabs) && git commit -m with && git checkout side2d && test_seq 1 9 >"$(printf "i\tam\ttabbed")" && echo ten >>"$(printf "i\tam\ttabbed")" && git add *tabbed && + side2df=$(git hash-object *tabbed) && git commit -m iam && git checkout -b funny-names-mergery side1d && git merge --no-commit side2d && @@ -494,12 +499,14 @@ test_expect_success FUNNYNAMES 'setup for --combined-all-paths with funny names' echo eleven >>"$(printf "i\tam\ttabbed")" && git mv "$(printf "i\tam\ttabbed")" "$(printf "fickle\tnaming")" && git add fickle* && - git commit + headf=$(git hash-object fickle*) && + git commit && + head=$(git rev-parse HEAD) ' test_expect_success FUNNYNAMES '--combined-all-paths and --raw and funny names' ' - cat <<-\EOF >expect && - ::100644 100644 100644 f00c965d8307308469e537302baa73048488f162 088bd5d92c2a8e0203ca8e7e4c2a5c692f6ae3f7 333b9c62519f285e1854830ade0fe1ef1d40ee1b RR "file\twith\ttabs" "i\tam\ttabbed" "fickle\tnaming" + cat <<-EOF >expect && + ::100644 100644 100644 $side1df $side2df $headf RR "file\twith\ttabs" "i\tam\ttabbed" "fickle\tnaming" EOF git diff-tree -c -M --raw --combined-all-paths HEAD >actual.tmp && sed 1d actual && @@ -507,7 +514,7 @@ test_expect_success FUNNYNAMES '--combined-all-paths and --raw and funny names' ' test_expect_success FUNNYNAMES '--combined-all-paths and --raw -and -z and funny names' ' - printf "aaf8087c3cbd4db8e185a2d074cf27c53cfb75d7\0::100644 100644 100644 f00c965d8307308469e537302baa73048488f162 088bd5d92c2a8e0203ca8e7e4c2a5c692f6ae3f7 333b9c62519f285e1854830ade0fe1ef1d40ee1b RR\0file\twith\ttabs\0i\tam\ttabbed\0fickle\tnaming\0" >expect && + printf "$head\0::100644 100644 100644 $side1df $side2df $headf RR\0file\twith\ttabs\0i\tam\ttabbed\0fickle\tnaming\0" >expect && git diff-tree -c -M --raw --combined-all-paths -z HEAD >actual && test_cmp -a expect actual ' From patchwork Sat Oct 5 21:12:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175873 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 0318876 for ; Sat, 5 Oct 2019 21:12:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD657222C8 for ; Sat, 5 Oct 2019 21:12:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="SNxVTcRV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726152AbfJEVMY (ORCPT ); Sat, 5 Oct 2019 17:12:24 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36342 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbfJEVMW (ORCPT ); Sat, 5 Oct 2019 17:12: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 D4E3B61C64; Sat, 5 Oct 2019 21:12:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309942; bh=na4mlvcxbHZ7355PqSw5f5f4BecqYOhtOH90JBEPPyE=; 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=SNxVTcRV0e9IFfzyB16Y23u1pE9VTFirOmLzIpPWi5g2Pu4ugcsYvWJ5jvuZIbrrg NkRCbD6U1YECegaE+xQU6+/8J7XYpgX09FKv1bcCFnCpzapE8vxibsleeODlNN7ppr 57Gy4MI8TNXHyzfuxfKyDeqym3qnMlPSmmNZdAGsq5EJFRGmh34Rmzi0C05h8qsf7l MhHkvb/oYirecWSaypiGQgl+/1u9/JWGApyv+mM4EVA7PGJj9PfAh5Nax2PatLOW2P QMm8cEzBBGa6fKT0KNEjYFbEHmEyMK6RUCpaWGSaUQxu52xoQK0V27xWRuMuGmymyo 7zpeS+TdIOw2g4STAnzgp8MH3HtCVaO68drX5T42j1n1nSehZ1p1SyvUR2w6UYbI8L yIDqC2FrqgRWFsSQ+8V0JEs5vkwynq1HK1koo+QrHMcXMsPY7gYGKan1qais1yRrc3 nXxSAHzi6AkpOrihT6+i1MwZG0XC+DEF8lf18GKKJu6u6MAjmxV From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 12/15] t4039: abstract away SHA-1-specific constants Date: Sat, 5 Oct 2019 21:12:06 +0000 Message-Id: <20191005211209.18237-13-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 Adjust the test so that it computes variables for object IDs instead of using hard-coded hashes. Signed-off-by: brian m. carlson --- t/t4039-diff-assume-unchanged.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t4039-diff-assume-unchanged.sh b/t/t4039-diff-assume-unchanged.sh index 53ac44b0f0..0eb0314a8b 100755 --- a/t/t4039-diff-assume-unchanged.sh +++ b/t/t4039-diff-assume-unchanged.sh @@ -12,6 +12,7 @@ test_expect_success 'setup' ' git commit -m zero && echo one > one && echo two > two && + blob=$(git hash-object one) && git add one two && git commit -m onetwo && git update-index --assume-unchanged one && @@ -20,7 +21,7 @@ test_expect_success 'setup' ' ' test_expect_success 'diff-index does not examine assume-unchanged entries' ' - git diff-index HEAD^ -- one | grep -q 5626abf0f72e58d7a153368ba57db4c673c0e171 + git diff-index HEAD^ -- one | grep -q $blob ' test_expect_success 'diff-files does not examine assume-unchanged entries' ' From patchwork Sat Oct 5 21:12:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175877 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 07CE076 for ; Sat, 5 Oct 2019 21:12:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA2BE222C0 for ; Sat, 5 Oct 2019 21:12:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="Uhrs/+uR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726166AbfJEVMZ (ORCPT ); Sat, 5 Oct 2019 17:12:25 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36350 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726131AbfJEVMY (ORCPT ); Sat, 5 Oct 2019 17:12: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 5BA0561C6E; Sat, 5 Oct 2019 21:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309942; bh=caxNNuYwTJoI8ptat8Y449AK/P/k0yNfqXKdzaJFfYs=; 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=Uhrs/+uRC2FhT5rVLoEFk8Zk5/cMVvICjfC8wPS4BgonibaksWnyMx4ZT+MdNLVeE q23a+G+IKGnL39iAexpUecZIRwzBbZCnkzKo4QNVivI/BWS+msqah/g6gk0KVth+Rf wQy6b/PZWhXmcd20jh4DuXtGsOyr8ClweLXQHfwOs+8LYVTAycEI3ei8Egrn6V9sMv boN0UDqMt6Vyhz8uJMfzwv0siakrDHHi+1O604QBu/g/sHbXIaR9xcWjHu2O45OICM KTZHDEjB4D/WGGAyXKqHoqU5+uv592BE6CkGiUjiEoYwHM/ZGXMd27OTCC0Uj56bAd wHsVJhbo1HM6zFTbMbF3tRjoWz7gmaOaX/rybOgfjH7fB7xJh6G60UKeQymEuaRH4+ wG4awWLxVf9fJbUwr1MKWWPc+RzJukTnl966vERrVM9APT5on2YmdH+AUtcyquUf0X KE7ZWxK0kZyx8Ut9lKTns5x7DDUzzvlB2pM4VAgLCsFYPSzHVMx From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 13/15] t4044: update test to work with SHA-256 Date: Sat, 5 Oct 2019 21:12:07 +0000 Message-Id: <20191005211209.18237-14-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 This test produces pseudo-collisions and tests git diff's behavior with them, and is therefore sensitive to the hash in use. Update the test to compute the collisions for both SHA-1 and SHA-256 using appropriate constants. Move the heredocs inside the setup block so that all of the setup code can be tested for failure. Signed-off-by: brian m. carlson --- t/t4044-diff-index-unique-abbrev.sh | 46 +++++++++++++++++++---------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/t/t4044-diff-index-unique-abbrev.sh b/t/t4044-diff-index-unique-abbrev.sh index 647905e01f..4701796d10 100755 --- a/t/t4044-diff-index-unique-abbrev.sh +++ b/t/t4044-diff-index-unique-abbrev.sh @@ -3,34 +3,48 @@ test_description='test unique sha1 abbreviation on "index from..to" line' . ./test-lib.sh -if ! test_have_prereq SHA1 -then - skip_all='not using SHA-1 for objects' - test_done -fi - -cat >expect_initial <expect_update < foo && + hash1 sha1:51d2738463ea4ca66f8691c91e33ce64b7d41bb1 + hash1 sha256:ae31dfff0af93b2c62b0098a039b38569c43b0a7e97b873000ca42d128f27350 + + hasht1 sha1:51d27384 + hasht1 sha256:ae31dfff + + hash2 sha1:51d2738efb4ad8a1e40bed839ab8e116f0a15e47 + hash2 sha256:ae31dffada88a46fd5f53c7ed5aa25a7a8951f1d5e88456c317c8d5484d263e5 + + hasht2 sha1:51d2738e + hasht2 sha256:ae31dffa + EOF + + cat >expect_initial <<-EOF && + 100644 blob $(test_oid hash1) foo + EOF + + cat >expect_update <<-EOF && + 100644 blob $(test_oid hash2) foo + EOF + + echo "$(test_oid val1)" > foo && git add foo && git commit -m "initial" && git cat-file -p HEAD: > actual && test_cmp expect_initial actual && - echo 11742 > foo && + echo "$(test_oid val2)" > foo && git commit -a -m "update" && git cat-file -p HEAD: > actual && test_cmp expect_update actual ' cat >expect < X-Patchwork-Id: 11175883 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 E525B76 for ; Sat, 5 Oct 2019 21:12:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C43D2222C8 for ; Sat, 5 Oct 2019 21:12:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="KQPnPaUI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726173AbfJEVM1 (ORCPT ); Sat, 5 Oct 2019 17:12:27 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36352 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbfJEVMX (ORCPT ); Sat, 5 Oct 2019 17:12: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 D7A0C61C70; Sat, 5 Oct 2019 21:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309943; bh=xAwPFCa9jKc9F2OPJiKnOhVwiuwkg/OZ8jdoqr7wNIU=; 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=KQPnPaUI7yRXMziQWKGpBCOschX87hAB8mVTN69X/SS8qwHiWw2DZkgrj3cjQ6sel bwct4r7HKcCN1qxuhsgVm+adfW1pUafFUDZPTZt65oFnnhZz1JXPia4wxUJgsf6dhI Rs9rhuHsz77J9XuU7cXS7awJnxzBQBipOClHXG+ySahi6IS6H47Iu+dlksssf7mbFh rvMw+Pqxl5/qAlnCcjqA2fyKC1Lls+vUhFe6oPXLF6FeCtzYDD68r7P7dMSWvv5RU6 X6U/bze4hzfrfIJjfdsc+GwbiaxnDtWez5hrfmHYYjNNSGEp+vHCXOyN9ahjqsp8v9 yr+R4MqUmH1l98GmT/3kWVYqnBsLfFSS4KUYJRlzavAcGo6JlEDtDHKYu4s2FjGD5o Na8ATf/HwZuWibMKJBiswaIfYD0VIsbBxoj2z3mc4D3G9lvmfA8mgIBCouHEkDcT/G /MPJDiczSWYeoW1ZJBd7tJdX+MXybPJLd/utOiif7TygEC2Jffm From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 14/15] t4045: make hash-size independent Date: Sat, 5 Oct 2019 21:12:08 +0000 Message-Id: <20191005211209.18237-15-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 Replace a hard-coded all-zeros object ID with a use of $ZERO_OID. Signed-off-by: brian m. carlson --- t/t4045-diff-relative.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh index 36f8ed8a81..258808708e 100755 --- a/t/t4045-diff-relative.sh +++ b/t/t4045-diff-relative.sh @@ -70,7 +70,7 @@ check_raw () { expect=$1 shift cat >expected <<-EOF - :000000 100644 0000000000000000000000000000000000000000 $blob A $expect + :000000 100644 $ZERO_OID $blob A $expect EOF test_expect_success "--raw $*" " git -C '$dir' diff --no-abbrev --raw $* HEAD^ >actual && From patchwork Sat Oct 5 21:12:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 11175879 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 BBB9716B1 for ; Sat, 5 Oct 2019 21:12:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A830222C0 for ; Sat, 5 Oct 2019 21:12:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="xAKbrkDK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726170AbfJEVMZ (ORCPT ); Sat, 5 Oct 2019 17:12:25 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:36342 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726139AbfJEVMZ (ORCPT ); Sat, 5 Oct 2019 17:12: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 69B1C61C71; Sat, 5 Oct 2019 21:12:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1570309943; bh=v+qOBlhknk2JmCEKxVPu22ZOeyUBzrkh2PeLVzN8pEM=; 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=xAKbrkDKlTtiGnJw4RBsOTXPjxwbcgIzRAsvijFJZN0Xxdpu9cKW5pJ+q1oXFW3xP 4gX/6kniLb0AaAF2DTK9jjGV65h0/8J8z+UgoLVmHT3PbY65sACtKluW9H8YcqvjNk /M4Gvk2XlBsqx/KfwGqjkFNvesSsqndp+hGkJsrncexDAbRca5P4KGmuMFhBNgIvXx nBL625tgWuqiaKrYCNqAGZSk6o+h3Msut1lGFmiHcPYFJFDWCfOLYteq/K4NOtG+AR gxQSaYDKrbvKAbMcpweRgHRIF3nPbaW4+3XrsRogVrncU/Zr6xLnnx4QSxGVfFe2g5 GxLw3K1Jyuq7rrX+AMradScSQRBv9XDnAqBcRihnnpA2S/Ob+/oVSWBjAjifpDURRx HCkyIJaSIxzl/hOJfCwLOPkTpe8Vvc4wOxT1riZBkFfn6AqBjusKYjEo9GZ93cWdON LMTBnJ2q/JijRfxzg+eahzm2XimTr0fAX4sP3I6MJEcPYsLyaMN From: "brian m. carlson" To: Cc: Stefan Beller , Johannes Schindelin Subject: [PATCH 15/15] t4048: abstract away SHA-1-specific constants Date: Sat, 5 Oct 2019 21:12:09 +0000 Message-Id: <20191005211209.18237-16-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb In-Reply-To: <20191005211209.18237-1-sandals@crustytoothpaste.net> References: <20191005211209.18237-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 Adjust the test so that it computes variables for object IDs instead of using hard-coded hashes. Signed-off-by: brian m. carlson --- t/t4048-diff-combined-binary.sh | 58 ++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/t/t4048-diff-combined-binary.sh b/t/t4048-diff-combined-binary.sh index 87a8949500..7f9ad9fa3d 100755 --- a/t/t4048-diff-combined-binary.sh +++ b/t/t4048-diff-combined-binary.sh @@ -9,24 +9,27 @@ test_expect_success 'setup binary merge conflict' ' git commit -m one && echo twoQ2 | q_to_nul >binary && git commit -a -m two && + two=$(git rev-parse --short HEAD:binary) && git checkout -b branch-binary HEAD^ && echo threeQ3 | q_to_nul >binary && git commit -a -m three && + three=$(git rev-parse --short HEAD:binary) && test_must_fail git merge master && echo resolvedQhooray | q_to_nul >binary && - git commit -a -m resolved + git commit -a -m resolved && + res=$(git rev-parse --short HEAD:binary) ' -cat >expect <<'EOF' +cat >expect <expect <<'EOF' +cat >expect <expect <<'EOF' +cat >expect <.gitattributes ' -cat >expect <<'EOF' +cat >expect <expect <<'EOF' +cat >expect <expect <<'EOF' +cat >expect <expect <<'EOF' +cat >expect <expect <<'EOF' +cat >expect <expect <<'EOF' +cat >expect <expect <<'EOF' +cat >expect <expect <<'EOF' +cat >expect <