From patchwork Tue Jul 28 23:34:25 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: 11690127 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 BC79014E3 for ; Tue, 28 Jul 2020 23:35:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9C0302075D for ; Tue, 28 Jul 2020 23:35:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.b="jfw/kWj8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730475AbgG1Xft (ORCPT ); Tue, 28 Jul 2020 19:35:49 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:40974 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730413AbgG1Xfh (ORCPT ); Tue, 28 Jul 2020 19:35:37 -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 20BCC609CF; Tue, 28 Jul 2020 23:35:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1595979303; bh=Bim6nM22V1FnBq0vFaPtCxlhtoicTjyB7iM0FKvI7bc=; 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=jfw/kWj8BvNSFPJsOju0zcTNKq4upTWVDiNW8lVMoG7nHfszdXDNtlJPzgje+5qJY mzwfNjNOjEo976//R0B91DZxNprCUgY0uX3FzyxRTyyNhWpGkhMZU7PLxU4nK1Y605 ku7yI+hqqQ0LmMt7nZ/kjEaufN3HIjavbPxKh/30Oxu7bTkD9mLqFVxNUYLWm2sA2q aTuGBEY8VwzGsXXJ2yGXL1Ecs9odVBoO4NFu+FMHg1ovd5JSOcRsPWobOP19vRYxLi KXcfIt3ZQNXTGd3zYblcYiEavLLGlG37m/FUAUyubmFmMtR9diPBBYJ5ERPeMrm/Sx W7Iwr42dZFH/IWh3hwyUnwjCxcm/GRA5SiuCEBdmEvMlEZvamJWmNzlMAj14JMMAab gMYQeDKqNwCBJcQ4lAMVIfMr3CTPlMyCoANj8mjLVt/DpTM/IprUGdqETvRek/M6My ujU5k937gNd2CbLXf+5sDYcS8t6FjN04BxOp0uj+KweMSno0v9w From: "brian m. carlson" To: Cc: Eric Sunshine Subject: [PATCH v5 18/39] t8002: make hash size independent Date: Tue, 28 Jul 2020 23:34:25 +0000 Message-Id: <20200728233446.3066485-19-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.28.0.163.g6104cc2f0b6 In-Reply-To: <20200728233446.3066485-1-sandals@crustytoothpaste.net> References: <20200728233446.3066485-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 the length of an object ID instead of hard-coding 40-based values. Signed-off-by: brian m. carlson --- t/t8002-blame.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/t/t8002-blame.sh b/t/t8002-blame.sh index eea048e52c..c3b70b025e 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' ' + hexsz=$(test_oid hexsz) +' + test_expect_success 'blame untracked file in empty repo' ' >untracked && test_must_fail git blame untracked @@ -105,17 +109,17 @@ 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 + 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' '