t8008: rely on rev-parse'd HEAD instead of sha1 value
Remove hard coded sha1 values, obtain the values using 'git rev-parse HEAD' which should be future proof regardless of the hash function used. Additionally future-proof the test by hard coding the abbreviation length of the hash. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Jul 26, 2017 at 12:06 UTC
0ba9c9a0fb8f09577346cf15162956a96b0a30fb
1 file changed
+16
-14
t/t8008-blame-formats.sh
+16
-14
@@ -12,22 +12,25 @@ test_expect_success 'setup' '
12
echo c >>file &&
13
echo d >>file &&
14
test_tick &&
15
- git commit -a -m two
15
+ git commit -a -m two &&
16
+ ID1=$(git rev-parse HEAD^) &&
17
+ shortID1="^$(git rev-parse HEAD^ |cut -c 1-17)" &&
18
+ ID2=$(git rev-parse HEAD) &&
19
+ shortID2="$(git rev-parse HEAD |cut -c 1-18)"
20
'
21
18
-cat >expect <<'EOF'
19
-^baf5e0b (A U Thor 2005-04-07 15:13:13 -0700 1) a
20
-8825379d (A U Thor 2005-04-07 15:14:13 -0700 2) b
21
-8825379d (A U Thor 2005-04-07 15:14:13 -0700 3) c
22
-8825379d (A U Thor 2005-04-07 15:14:13 -0700 4) d
22
+cat >expect <<EOF
23
+$shortID1 (A U Thor 2005-04-07 15:13:13 -0700 1) a
24
+$shortID2 (A U Thor 2005-04-07 15:14:13 -0700 2) b
25
+$shortID2 (A U Thor 2005-04-07 15:14:13 -0700 3) c
26
+$shortID2 (A U Thor 2005-04-07 15:14:13 -0700 4) d
27
EOF
28
test_expect_success 'normal blame output' '
25
- git blame file >actual &&
29
+ git blame --abbrev=17 file >actual &&
30
test_cmp expect actual
31
'
32
29
-ID1=baf5e0b3869e0b2b2beb395a3720c7b51eac94fc
30
-COMMIT1='author A U Thor
33
+COMMIT1="author A U Thor
34
author-mail <author@example.com>
35
author-time 1112911993
36
author-tz -0700
@@ -37,9 +40,8 @@ committer-time 1112911993
40
committer-tz -0700
41
summary one
42
boundary
40
-filename file'
41
-ID2=8825379dfb8a1267b58e8e5bcf69eec838f685ec
42
-COMMIT2='author A U Thor
43
+filename file"
44
+COMMIT2="author A U Thor
45
author-mail <author@example.com>
46
author-time 1112912053
47
author-tz -0700
@@ -48,8 +50,8 @@ committer-mail <committer@example.com>
50
committer-time 1112912053
51
committer-tz -0700
52
summary two
51
-previous baf5e0b3869e0b2b2beb395a3720c7b51eac94fc file
52
-filename file'
53
+previous $ID1 file
54
+filename file"
55
56
cat >expect <<EOF
57
$ID1 1 1 1