path: root/t/
diff options
authorÆvar Arnfjörð Bjarmason <>2021-10-15 09:30:16 (GMT)
committerJunio C Hamano <>2021-10-15 16:36:46 (GMT)
commit15b808da74eb239ad8fcdbe6168ed0b5260eadc1 (patch)
tree58296069c63e99a5aca8c5ed24303faf95ac53b3 /t/
parentaf6d1d602a8f64164b266364339c4e936d5bbc33 (diff)
"lib-diff" tests: make "README" and "COPYING" test data smaller
Follow-up the change in 459b8d22e54 (tests: do not borrow from COPYING and README from the real source, 2015-02-15) by not shipping a full copy of older versions of the top-level "COPYING" and "README" files. The tests that use them just need the small blurb at the top of "COPYING" as test data, or mock data that's dissimilar. Let's provide that with a "COPYING_test_data" function instead. We're not replacing this with some other generic test data (e.g. "lorum ipsum") because these tests require test file header to be the old "COPYING" file. See e.g. "" which changes the file, and then does full "test_cmp" comparisons on the resulting "git diff" output. This change only changes tests that used the "" library, but splits up what they need into a new "". A subsequent commit will change related tests that were missed in 459b8d22e54. For the test in "" the "README" file can go away in favor of echoing the line "some dissimilar content" to a file in the one test that needed it. The point of that test is to start with files "A" and "B", and then have A be more similar to the state of "B" than to its old version (by copying over the content from the "COPYING" file). Just comparing the pre-image of "some dissimilar content" and later a munged version of the "COPYING" output serves that purpose. While we're at it get rid of a stray "echo $tree" debugging line added in 15d061b435a ([PATCH] Fix the way diffcore-rename records unremoved source., 2005-05-27), and stop calling "hash-object" to get the hash of an object we've just added to the index. We can instead extract that information from the index itself with "rev-parse". Signed-off-by: Ævar Arnfjörð Bjarmason <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 2 insertions, 2 deletions
diff --git a/t/ b/t/
index b1da807..59b7f44 100755
--- a/t/
+++ b/t/
@@ -11,7 +11,7 @@ test_description='Same rename detection as t4003 but testing diff-raw -z.
test_expect_success \
'prepare reference tree' \
+ 'COPYING_test_data >COPYING &&
echo frotz >rezrov &&
git update-index --add COPYING rezrov &&
orig=$(git hash-object COPYING) &&
@@ -81,7 +81,7 @@ test_expect_success \
test_expect_success \
'prepare work tree once again' \
+ 'COPYING_test_data >COPYING &&
git update-index --add --remove COPYING COPYING.1'
git diff-index -z -C --find-copies-harder $tree >current