Skip to content

Commit c6fc44e

Browse files
committed
Merge branch 'ab/test-lib-diff-cleanup'
Test clean-up. * ab/test-lib-diff-cleanup: tests: stop using top-level "README" and "COPYING" files "lib-diff" tests: make "README" and "COPYING" test data smaller
2 parents 63ec229 + 1c72035 commit c6fc44e

14 files changed

+53
-433
lines changed

t/.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
t[0-9][0-9][0-9][0-9]/* -whitespace
22
/chainlint/*.expect eol=lf
3-
/lib-diff/* eol=lf
43
/t0110/url-* binary
54
/t3206/* eol=lf
65
/t3900/*.txt eol=lf

t/lib-diff-data.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
COPYING_test_data () {
2+
cat <<\EOF
3+
4+
Note that the only valid version of the GPL as far as this project
5+
is concerned is _this_ particular version of the license (ie v2, not
6+
v2.2 or v3.x or whatever), unless explicitly otherwise stated.
7+
8+
HOWEVER, in order to allow a migration to GPLv3 if that seems like
9+
a good idea, I also ask that people involved with the project make
10+
their preferences known. In particular, if you trust me to make that
11+
decision, you might note so in your copyright message, ie something
12+
like
13+
14+
This file is licensed under the GPL v2, or a later version
15+
at the discretion of Linus.
16+
17+
might avoid issues. But we can also just decide to synchronize and
18+
contact all copyright holders on record if/when the occasion arises.
19+
20+
Linus Torvalds
21+
EOF
22+
}

t/lib-diff.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
. "$TEST_DIRECTORY"/lib-diff-data.sh
2+
13
:
24

35
sanitize_diff_raw='/^:/s/ '"\($OID_REGEX\)"' '"\($OID_REGEX\)"' \([A-Z]\)[0-9]* / \1 \2 \3# /'

t/lib-diff/COPYING

Lines changed: 0 additions & 361 deletions
This file was deleted.

t/lib-diff/README

Lines changed: 0 additions & 46 deletions
This file was deleted.

t/t4003-diff-rename-1.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test_description='More rename detection
1111

1212
test_expect_success \
1313
'prepare reference tree' \
14-
'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
14+
'COPYING_test_data >COPYING &&
1515
echo frotz >rezrov &&
1616
git update-index --add COPYING rezrov &&
1717
tree=$(git write-tree) &&
@@ -99,7 +99,7 @@ test_expect_success \
9999

100100
test_expect_success \
101101
'prepare work tree once again' \
102-
'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
102+
'COPYING_test_data >COPYING &&
103103
git update-index --add --remove COPYING COPYING.1'
104104

105105
# tree has COPYING and rezrov. work tree has COPYING and COPYING.1,

t/t4005-diff-rename-2.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test_description='Same rename detection as t4003 but testing diff-raw.'
99
. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
1010

1111
test_expect_success 'setup reference tree' '
12-
cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
12+
COPYING_test_data >COPYING &&
1313
echo frotz >rezrov &&
1414
git update-index --add COPYING rezrov &&
1515
tree=$(git write-tree) &&
@@ -64,7 +64,7 @@ test_expect_success 'validate output from rename/copy detection (#2)' '
6464
# nows how to say Copy.
6565

6666
test_expect_success 'validate output from rename/copy detection (#3)' '
67-
cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
67+
COPYING_test_data >COPYING &&
6868
git update-index --add --remove COPYING COPYING.1 &&
6969
7070
cat <<-EOF >expected &&

t/t4007-rename-3.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ test_description='Rename interaction with pathspec.
1111

1212
test_expect_success 'prepare reference tree' '
1313
mkdir path0 path1 &&
14-
cp "$TEST_DIRECTORY"/lib-diff/COPYING path0/COPYING &&
14+
COPYING_test_data >path0/COPYING &&
1515
git update-index --add path0/COPYING &&
1616
tree=$(git write-tree) &&
17-
echo $tree
17+
blob=$(git rev-parse :path0/COPYING)
1818
'
1919

20-
blob=$(git hash-object "$TEST_DIRECTORY/lib-diff/COPYING")
2120
test_expect_success 'prepare work tree' '
2221
cp path0/COPYING path1/COPYING &&
2322
git update-index --add --remove path0/COPYING path1/COPYING

t/t4008-diff-break-rewrite.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ Further, with -B and -M together, these should turn into two renames.
2525
. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
2626

2727
test_expect_success setup '
28-
cat "$TEST_DIRECTORY"/lib-diff/README >file0 &&
29-
cat "$TEST_DIRECTORY"/lib-diff/COPYING >file1 &&
28+
echo some dissimilar content >file0 &&
29+
COPYING_test_data >file1 &&
3030
blob0_id=$(git hash-object file0) &&
3131
blob1_id=$(git hash-object file1) &&
3232
git update-index --add file0 file1 &&

t/t4009-diff-rename-4.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test_description='Same rename detection as t4003 but testing diff-raw -z.
1111

1212
test_expect_success \
1313
'prepare reference tree' \
14-
'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
14+
'COPYING_test_data >COPYING &&
1515
echo frotz >rezrov &&
1616
git update-index --add COPYING rezrov &&
1717
orig=$(git hash-object COPYING) &&
@@ -81,7 +81,7 @@ test_expect_success \
8181

8282
test_expect_success \
8383
'prepare work tree once again' \
84-
'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
84+
'COPYING_test_data >COPYING &&
8585
git update-index --add --remove COPYING COPYING.1'
8686

8787
git diff-index -z -C --find-copies-harder $tree >current

0 commit comments

Comments
 (0)