Skip to content

Commit 496a698

Browse files
ashumkingitster
authored andcommitted
t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs
The expected SHA-1 digests are always available in variables. Use them instead of hardcoding. That was introduced in a742f2a (t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs, 2013-06-26) but unfortunately was not followed in 5e1361c (log: properly handle decorations with chained tags, 2013-12-17) Signed-off-by: Alexey Shumkin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6308767 commit 496a698

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

t/t4205-log-pretty-formats.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ EOF
296296
test_cmp expected actual
297297
'
298298

299+
# save HEAD's SHA-1 digest (with no abbreviations) to use it below
300+
# as far as the next test amends HEAD
301+
old_head1=$(git rev-parse --verify HEAD~0)
302+
299303
test_expect_success 'left/right alignment formatting with stealing' '
300304
git commit --amend -m short --author "long long long <[email protected]>" &&
301305
git log --pretty="format:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual &&
@@ -310,16 +314,20 @@ EOF
310314
test_cmp expected actual
311315
'
312316

317+
# get new digests (with no abbreviations)
318+
head1=$(git rev-parse --verify HEAD~0) &&
319+
head2=$(git rev-parse --verify HEAD~1) &&
320+
313321
test_expect_success 'log decoration properly follows tag chain' '
314322
git tag -a tag1 -m tag1 &&
315323
git tag -a tag2 -m tag2 tag1 &&
316324
git tag -d tag1 &&
317325
git commit --amend -m shorter &&
318326
git log --no-walk --tags --pretty="%H %d" --decorate=full >actual &&
319327
cat <<EOF >expected &&
320-
6a908c10688b2503073c39c9ba26322c73902bb5 (tag: refs/tags/tag2)
321-
9f716384d92283fb915a4eee5073f030638e05f9 (tag: refs/tags/message-one)
322-
b87e4cccdb77336ea79d89224737be7ea8e95367 (tag: refs/tags/message-two)
328+
$head1 (tag: refs/tags/tag2)
329+
$head2 (tag: refs/tags/message-one)
330+
$old_head1 (tag: refs/tags/message-two)
323331
EOF
324332
sort actual >actual1 &&
325333
test_cmp expected actual1

0 commit comments

Comments
 (0)