t8002: make hash size independent
Compute the length of an object ID instead of hard-coding 40-based values. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Reviewed-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Jul 29, 2020 at 23:14 UTC
98de0b27bf1f3475aaf3a3e6244741831d0b6489
1 file changed
+11
-7
t/t8002-blame.sh
+11
-7
@@ -6,6 +6,10 @@ test_description='git blame'
6
PROG='git blame -c'
7
. "$TEST_DIRECTORY"/annotate-tests.sh
8
9
+test_expect_success 'setup' '
10
+ hexsz=$(test_oid hexsz)
11
+'
12
+
13
test_expect_success 'blame untracked file in empty repo' '
14
>untracked &&
15
test_must_fail git blame untracked
@@ -105,17 +109,17 @@ test_expect_success 'blame --abbrev=<n> works' '
109
'
110
111
test_expect_success 'blame -l aligns regular and boundary commits' '
108
- check_abbrev 40 -l HEAD &&
109
- check_abbrev 39 -l ^HEAD
112
+ check_abbrev $hexsz -l HEAD &&
113
+ check_abbrev $((hexsz - 1)) -l ^HEAD
114
'
115
112
-test_expect_success 'blame --abbrev=40 behaves like -l' '
113
- check_abbrev 40 --abbrev=40 HEAD &&
114
- check_abbrev 39 --abbrev=40 ^HEAD
116
+test_expect_success 'blame --abbrev with full length behaves like -l' '
117
+ check_abbrev $hexsz --abbrev=$hexsz HEAD &&
118
+ check_abbrev $((hexsz - 1)) --abbrev=$hexsz ^HEAD
119
'
120
117
-test_expect_success '--no-abbrev works like --abbrev=40' '
118
- check_abbrev 40 --no-abbrev
121
+test_expect_success '--no-abbrev works like --abbrev with full length' '
122
+ check_abbrev $hexsz --no-abbrev
123
'
124
125
test_expect_success '--exclude-promisor-objects does not BUG-crash' '