t5520: test single-line files by git with test_cmp
authorDenton Liu <liu.denton@gmail.com>
Tue, 12 Nov 2019 23:08:07 +0000 (15:08 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Nov 2019 00:41:51 +0000 (09:41 +0900)
commit5540ed27bcf30869b2f56e421cb9f52520d2c0a0
treec33b7ee77ab3f464c07466a77dc43ddfa2c6cd14
parentdd0f1e767b79009f5edd01d3c917f1cf186e60c9
t5520: test single-line files by git with test_cmp

In case an invocation of a git command fails within the command
substitution, the failure will be masked. Replace the command
substitution with a file-redirection and a call to test_cmp.

This change was done with the following GNU sed expressions:

s/\(\s*\)test \([^ ]*\) = "$(\(git [^)]*\))"/\1echo \2 >expect \&\&\n\1\3 >actual \&\&\n\1test_cmp expect actual/
s/\(\s*\)test "$(\(git [^)]*\))" = \([^ ]*\)/\1echo \3 >expect \&\&\n\1\2 >actual \&\&\n\1test_cmp expect actual/

A future patch will clean up situations where we have multiple duplicate
statements within a test case. This is done to keep this patch purely
mechanical.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5520-pull.sh