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 5AB001F8DF for ; Sun, 26 Jul 2020 19:55:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727956AbgGZTyx (ORCPT ); Sun, 26 Jul 2020 15:54:53 -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 S1727898AbgGZTyu (ORCPT ); Sun, 26 Jul 2020 15:54:50 -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 38C2F607A2; Sun, 26 Jul 2020 19:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1595793289; bh=RpVYnItus+HxXa/K46QzWilqF94JaaAdzDof62lZ1fU=; 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=vjI5swlbf22BpC8zFYOMN8mYBfiztGHY+ATq9beegm5XzArRGUeOWRVRC4oyf4u02 AgWYzUV2vM0k9cnIFo5goKBIg3hp616VdXwmZeiABOyWaMdy0EaOOKOYc7SeqM7JC1 el2sZ0LoHfj7F9Vleie7U1QdtqNe9B1VxvGHpc+s/J2CjUebq6gmbHY9YCkMIRuKEp OqtU4t0EAaAVcqqVi2Jx8+MaK1JJHWSr+7LvW00BndhfLco6CvlGwuRgQ27io7Nv6m sESeB3la/bzFMoK0IHyFsN0ga8UwNnITEzuSOmmaiOL/lWaV/Xm0I+BXB7eN8Lg9Kp sz7MxlnRMrUcVUTye34PfivL1alxOxb4wLBkJnmbDDHXFG1pg902E543G3PpJ+j8kP QsENpcrTI/ICNBHUyKSAmBrYVwRatIxInnGYbrNh4O4N0JK9gXDzXEqdPh+UpGmUpx LJpvkkjVKL5hjtaK+A5FHRKZ65C5jDwzmaBDD/jZ9suuXmaVPRE From: "brian m. carlson" To: Cc: Eric Sunshine Subject: [PATCH v4 18/39] t8002: make hash size independent Date: Sun, 26 Jul 2020 19:54:03 +0000 Message-Id: <20200726195424.626969-19-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 Compute the length of an object ID instead of of hard-coding 40-based values. Signed-off-by: brian m. carlson --- t/t8002-blame.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/t/t8002-blame.sh b/t/t8002-blame.sh index eea048e52c..557c886559 100755 --- a/t/t8002-blame.sh +++ b/t/t8002-blame.sh @@ -6,6 +6,10 @@ test_description='git blame' PROG='git blame -c' . "$TEST_DIRECTORY"/annotate-tests.sh +test_expect_success 'setup' ' + test_oid_init +' + test_expect_success 'blame untracked file in empty repo' ' >untracked && test_must_fail git blame untracked @@ -105,17 +109,18 @@ test_expect_success 'blame --abbrev= works' ' ' test_expect_success 'blame -l aligns regular and boundary commits' ' - check_abbrev 40 -l HEAD && - check_abbrev 39 -l ^HEAD + hexsz=$(test_oid hexsz) && + check_abbrev $hexsz -l HEAD && + check_abbrev $((hexsz - 1)) -l ^HEAD ' -test_expect_success 'blame --abbrev=40 behaves like -l' ' - check_abbrev 40 --abbrev=40 HEAD && - check_abbrev 39 --abbrev=40 ^HEAD +test_expect_success 'blame --abbrev with full length behaves like -l' ' + check_abbrev $hexsz --abbrev=$hexsz HEAD && + check_abbrev $((hexsz - 1)) --abbrev=$hexsz ^HEAD ' -test_expect_success '--no-abbrev works like --abbrev=40' ' - check_abbrev 40 --no-abbrev +test_expect_success '--no-abbrev works like --abbrev with full length' ' + check_abbrev $hexsz --no-abbrev ' test_expect_success '--exclude-promisor-objects does not BUG-crash' '