From patchwork Sun Jun 16 18:53:22 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: 10997627 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 94EC214DB for ; Sun, 16 Jun 2019 18:54:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87CCA28716 for ; Sun, 16 Jun 2019 18:54:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C2E328812; Sun, 16 Jun 2019 18:54:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C70FE28815 for ; Sun, 16 Jun 2019 18:54:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727246AbfFPSxx (ORCPT ); Sun, 16 Jun 2019 14:53:53 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:60136 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725920AbfFPSxx (ORCPT ); Sun, 16 Jun 2019 14:53:53 -0400 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:159e:486:c87b:cfd7]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id BF84B60735; Sun, 16 Jun 2019 18:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1560711231; bh=o+hxGFYz64vS5YwtrbB7b/CV3HWIJJVxh/QPX6mBBKc=; 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=AL/7IH6cjHN0IceTUg9vCOq84we5rGoOtU8TRdwHfn9VDppX6OipTdwDT9MKGwiXr 3fKScq/BthQHrI3Xn37SP4hP/DAwYtpSLBA6j7NHkEBDpaSYSDwn1bc1UZdUAsepPW EQ74BjmXld2R/ScUjpCUwJewo2L80WBLR98I4pSZe6+MIgeEqQGq5HNmVYG2khaqz4 XUZRzQqEabsnZ/uiWpNmRKQuQbDe6qN7+bYdAXpMVJ366jBvOiI381zdC9EHXTnnm8 h2YlOy8zaC7FOF1/vNd10iGfgBzztf/7f+bDqrZy9B2/9ZY9fUYZbykPcJVT2Qx23d YBOZZPPTeGmbISLDEoAiQ+4lYuebChRpFFEmeBFZcTjYr+t3+nNENMX5nGtQHm22J1 aKl6wwsz9YRp+HKc5CdfmfSLDMlmLIwWS/rQs+/mB3TNqhBnY1u8RfzGOJP3F+A4Ic /i8SXCUhZJ64uZb04WT4GVVfDWMFXJU6mwNy+76jGIxrO9+1fbs From: "brian m. carlson" To: Cc: Jeff King , Duy Nguyen , Johannes Schindelin , Jonathan Tan , Eric Sunshine , Junio C Hamano Subject: [PATCH v2 02/10] t1410: make hash size independent Date: Sun, 16 Jun 2019 18:53:22 +0000 Message-Id: <20190616185330.549436-3-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5 In-Reply-To: <20190616185330.549436-1-sandals@crustytoothpaste.net> References: <20190616185330.549436-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of parsing object IDs using fixed-length shell patterns, use cut to extract the first two characters of an object ID in addition to the test helper for object paths. Update another test to look up an appropriate object ID fragment from the all-zeros object ID instead of hardcoding the value. Although the test for parsing reflogs at BUFSIZ boundaries passes, mark it with the SHA1 prerequisite, as it doesn't currently usefully test anything when using a hash longer than 20 bytes. Signed-off-by: brian m. carlson --- t/t1410-reflog.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index 79f731db37..82950c0282 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -30,14 +30,13 @@ check_fsck () { } corrupt () { - aa=${1%??????????????????????????????????????} zz=${1#??} - mv .git/objects/$aa/$zz .git/$aa$zz + mv .git/objects/$(test_oid_to_path $1) .git/$1 } recover () { - aa=${1%??????????????????????????????????????} zz=${1#??} + aa=$(echo $1 | cut -c 1-2) mkdir -p .git/objects/$aa - mv .git/$aa$zz .git/objects/$aa/$zz + mv .git/$1 .git/objects/$(test_oid_to_path $1) } check_dont_have () { @@ -55,6 +54,7 @@ check_dont_have () { } test_expect_success setup ' + test_oid_init && mkdir -p A/B && echo rat >C && echo ox >A/D && @@ -313,12 +313,12 @@ test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' ' # Each line is 114 characters, so we need 75 to still have a few before the # last 8K. The 89-character padding on the final entry lines up our # newline exactly. -test_expect_success 'parsing reverse reflogs at BUFSIZ boundaries' ' +test_expect_success SHA1 'parsing reverse reflogs at BUFSIZ boundaries' ' git checkout -b reflogskip && - z38=00000000000000000000000000000000000000 && + zf=$(test_oid zero_2) && ident="abc 0000000001 +0000" && for i in $(test_seq 1 75); do - printf "$z38%02d $z38%02d %s\t" $i $(($i+1)) "$ident" && + printf "$zf%02d $zf%02d %s\t" $i $(($i+1)) "$ident" && if test $i = 75; then for j in $(test_seq 1 89); do printf X @@ -329,7 +329,7 @@ test_expect_success 'parsing reverse reflogs at BUFSIZ boundaries' ' printf "\n" done >.git/logs/refs/heads/reflogskip && git rev-parse reflogskip@{73} >actual && - echo ${z38}03 >expect && + echo ${zf}03 >expect && test_cmp expect actual '