@matheusbsbs / matheus-bagliano / commits / bfdbee9810
Fork 0

tests: use $TEST_DIRECTORY to refer to the t/ directory

Many test scripts assumed that they will start in a 'trash' subdirectory that is a single level down from the t/ directory, and referred to their test vector files by asking for files like "../t9999/expect". This will break if we move the 'trash' subdirectory elsewhere. To solve this, we earlier introduced "$TEST_DIRECTORY" so that they can refer to t/ directory reliably. This finally makes all the tests use it to refer to the outside environment. With this patch, and a one-liner not included here (because it would contradict with what Dscho really wants to do): | diff --git a/t/test-lib.sh b/t/test-lib.sh | index 70ea7e0..60e69e4 100644 | --- a/t/test-lib.sh | +++ b/t/test-lib.sh | @@ -485,7 +485,7 @@ fi | . ../GIT-BUILD-OPTIONS | | # Test repository | -test="trash directory" | +test="trash directory/another level/yet another" | rm -fr "$test" || { | trap - exit | echo >&5 "FATAL: Cannot prepare test area" all the tests still pass, but we would want extra sets of eyeballs on this type of change to really make sure. [jc: with help from Stephan Beyer on http-push tests I do not run myself; credits for locating silly quoting errors go to Olivier Marin.] Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Aug 8, 2008 at 02:26 UTC bfdbee98109c5ad2dbbc392e7eed1ae688acc039
51 files changed +152 -134
t/lib-httpd.sh
+1 -1
@@ -14,7 +14,7 @@ fi
14 LIB_HTTPD_PATH=${LIB_HTTPD_PATH-'/usr/sbin/apache2'}
15 LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'}
16
17 -TEST_PATH="$PWD"/../lib-httpd
17 +TEST_PATH="$TEST_DIRECTORY"/lib-httpd
18 HTTPD_ROOT_PATH="$PWD"/httpd
19 HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www
20
t/t0022-crlf-rename.sh
+2 -2
@@ -6,13 +6,13 @@ test_description='ignore CR in CRLF sequence while computing similiarity'
6
7 test_expect_success setup '
8
9 - cat ../t0022-crlf-rename.sh >sample &&
9 + cat "$TEST_DIRECTORY"/t0022-crlf-rename.sh >sample &&
10 git add sample &&
11
12 test_tick &&
13 git commit -m Initial &&
14
15 - sed -e "s/\$/ /" ../t0022-crlf-rename.sh >elpmas &&
15 + sed -e "s/\$/ /" "$TEST_DIRECTORY"/t0022-crlf-rename.sh >elpmas &&
16 git add elpmas &&
17 rm -f sample &&
18
t/t1000-read-tree-m-3way.sh
+1 -1
@@ -72,7 +72,7 @@ In addition:
72
73 '
74 . ./test-lib.sh
75 -. ../lib-read-tree-m-3way.sh
75 +. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh
76
77 ################################################################
78 # Trivial "majority when 3 stages exist" merge plus #2ALT, #3ALT
t/t3900-i18n-commit.sh
+9 -9
@@ -16,7 +16,7 @@ test_expect_success setup '
16 : >F &&
17 git add F &&
18 T=$(git write-tree) &&
19 - C=$(git commit-tree $T <../t3900/1-UTF-8.txt) &&
19 + C=$(git commit-tree $T <"$TEST_DIRECTORY"/t3900/1-UTF-8.txt) &&
20 git update-ref HEAD $C &&
21 git-tag C0
22 '
@@ -32,7 +32,7 @@ do
32 git config i18n.commitencoding $H &&
33 git-checkout -b $H C0 &&
34 echo $H >F &&
35 - git-commit -a -F ../t3900/$H.txt
35 + git-commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt
36 '
37 done
38
@@ -57,13 +57,13 @@ test_expect_success 'config to remove customization' '
57 '
58
59 test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' '
60 - compare_with ISO-8859-1 ../t3900/1-UTF-8.txt
60 + compare_with ISO-8859-1 "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
61 '
62
63 for H in EUCJP ISO-2022-JP
64 do
65 test_expect_success "$H should be shown in UTF-8 now" '
66 - compare_with '$H' ../t3900/2-UTF-8.txt
66 + compare_with '$H' "$TEST_DIRECTORY"/t3900/2-UTF-8.txt
67 '
68 done
69
@@ -82,7 +82,7 @@ for H in ISO-8859-1 EUCJP ISO-2022-JP
82 do
83 test_expect_success "$H should be shown in itself now" '
84 git config i18n.commitencoding '$H' &&
85 - compare_with '$H' ../t3900/'$H'.txt
85 + compare_with '$H' "$TEST_DIRECTORY"/t3900/'$H'.txt
86 '
87 done
88
@@ -91,13 +91,13 @@ test_expect_success 'config to tweak customization' '
91 '
92
93 test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' '
94 - compare_with ISO-8859-1 ../t3900/1-UTF-8.txt
94 + compare_with ISO-8859-1 "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
95 '
96
97 for H in EUCJP ISO-2022-JP
98 do
99 test_expect_success "$H should be shown in UTF-8 now" '
100 - compare_with '$H' ../t3900/2-UTF-8.txt
100 + compare_with '$H' "$TEST_DIRECTORY"/t3900/2-UTF-8.txt
101 '
102 done
103
@@ -107,7 +107,7 @@ do
107 for H in EUCJP ISO-2022-JP
108 do
109 test_expect_success "$H should be shown in $J now" '
110 - compare_with '$H' ../t3900/'$J'.txt
110 + compare_with '$H' "$TEST_DIRECTORY"/t3900/'$J'.txt
111 '
112 done
113 done
@@ -115,7 +115,7 @@ done
115 for H in ISO-8859-1 EUCJP ISO-2022-JP
116 do
117 test_expect_success "No conversion with $H" '
118 - compare_with "--encoding=none '$H'" ../t3900/'$H'.txt
118 + compare_with "--encoding=none '$H'" "$TEST_DIRECTORY"/t3900/'$H'.txt
119 '
120 done
121
t/t3901-i18n-patch.sh
+14 -14
@@ -35,7 +35,7 @@ test_expect_success setup '
35
36 # use UTF-8 in author and committer name to match the
37 # i18n.commitencoding settings
38 - . ../t3901-utf8.txt &&
38 + . "$TEST_DIRECTORY"/t3901-utf8.txt &&
39
40 test_tick &&
41 echo "$GIT_AUTHOR_NAME" >mine &&
@@ -57,7 +57,7 @@ test_expect_success setup '
57 # the second one on the side branch is ISO-8859-1
58 git config i18n.commitencoding ISO-8859-1 &&
59 # use author and committer name in ISO-8859-1 to match it.
60 - . ../t3901-8859-1.txt &&
60 + . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
61 test_tick &&
62 echo Yet another >theirs &&
63 git add theirs &&
@@ -101,7 +101,7 @@ test_expect_success 'rebase (U/U)' '
101
102 # The result will be committed by GIT_COMMITTER_NAME --
103 # we want UTF-8 encoded name.
104 - . ../t3901-utf8.txt &&
104 + . "$TEST_DIRECTORY"/t3901-utf8.txt &&
105 git checkout -b test &&
106 git-rebase master &&
107
@@ -111,7 +111,7 @@ test_expect_success 'rebase (U/U)' '
111 test_expect_success 'rebase (U/L)' '
112 git config i18n.commitencoding UTF-8 &&
113 git config i18n.logoutputencoding ISO-8859-1 &&
114 - . ../t3901-utf8.txt &&
114 + . "$TEST_DIRECTORY"/t3901-utf8.txt &&
115
116 git reset --hard side &&
117 git-rebase master &&
@@ -123,7 +123,7 @@ test_expect_success 'rebase (L/L)' '
123 # In this test we want ISO-8859-1 encoded commits as the result
124 git config i18n.commitencoding ISO-8859-1 &&
125 git config i18n.logoutputencoding ISO-8859-1 &&
126 - . ../t3901-8859-1.txt &&
126 + . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
127
128 git reset --hard side &&
129 git-rebase master &&
@@ -136,7 +136,7 @@ test_expect_success 'rebase (L/U)' '
136 # to get ISO-8859-1 results.
137 git config i18n.commitencoding ISO-8859-1 &&
138 git config i18n.logoutputencoding UTF-8 &&
139 - . ../t3901-8859-1.txt &&
139 + . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
140
141 git reset --hard side &&
142 git-rebase master &&
@@ -149,7 +149,7 @@ test_expect_success 'cherry-pick(U/U)' '
149
150 git config i18n.commitencoding UTF-8 &&
151 git config i18n.logoutputencoding UTF-8 &&
152 - . ../t3901-utf8.txt &&
152 + . "$TEST_DIRECTORY"/t3901-utf8.txt &&
153
154 git reset --hard master &&
155 git cherry-pick side^ &&
@@ -164,7 +164,7 @@ test_expect_success 'cherry-pick(L/L)' '
164
165 git config i18n.commitencoding ISO-8859-1 &&
166 git config i18n.logoutputencoding ISO-8859-1 &&
167 - . ../t3901-8859-1.txt &&
167 + . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
168
169 git reset --hard master &&
170 git cherry-pick side^ &&
@@ -179,7 +179,7 @@ test_expect_success 'cherry-pick(U/L)' '
179
180 git config i18n.commitencoding UTF-8 &&
181 git config i18n.logoutputencoding ISO-8859-1 &&
182 - . ../t3901-utf8.txt &&
182 + . "$TEST_DIRECTORY"/t3901-utf8.txt &&
183
184 git reset --hard master &&
185 git cherry-pick side^ &&
@@ -195,7 +195,7 @@ test_expect_success 'cherry-pick(L/U)' '
195
196 git config i18n.commitencoding ISO-8859-1 &&
197 git config i18n.logoutputencoding UTF-8 &&
198 - . ../t3901-8859-1.txt &&
198 + . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
199
200 git reset --hard master &&
201 git cherry-pick side^ &&
@@ -208,7 +208,7 @@ test_expect_success 'cherry-pick(L/U)' '
208 test_expect_success 'rebase --merge (U/U)' '
209 git config i18n.commitencoding UTF-8 &&
210 git config i18n.logoutputencoding UTF-8 &&
211 - . ../t3901-utf8.txt &&
211 + . "$TEST_DIRECTORY"/t3901-utf8.txt &&
212
213 git reset --hard side &&
214 git-rebase --merge master &&
@@ -219,7 +219,7 @@ test_expect_success 'rebase --merge (U/U)' '
219 test_expect_success 'rebase --merge (U/L)' '
220 git config i18n.commitencoding UTF-8 &&
221 git config i18n.logoutputencoding ISO-8859-1 &&
222 - . ../t3901-utf8.txt &&
222 + . "$TEST_DIRECTORY"/t3901-utf8.txt &&
223
224 git reset --hard side &&
225 git-rebase --merge master &&
@@ -231,7 +231,7 @@ test_expect_success 'rebase --merge (L/L)' '
231 # In this test we want ISO-8859-1 encoded commits as the result
232 git config i18n.commitencoding ISO-8859-1 &&
233 git config i18n.logoutputencoding ISO-8859-1 &&
234 - . ../t3901-8859-1.txt &&
234 + . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
235
236 git reset --hard side &&
237 git-rebase --merge master &&
@@ -244,7 +244,7 @@ test_expect_success 'rebase --merge (L/U)' '
244 # to get ISO-8859-1 results.
245 git config i18n.commitencoding ISO-8859-1 &&
246 git config i18n.logoutputencoding UTF-8 &&
247 - . ../t3901-8859-1.txt &&
247 + . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
248
249 git reset --hard side &&
250 git-rebase --merge master &&
t/t4000-diff-format.sh
+1 -1
@@ -7,7 +7,7 @@ test_description='Test built-in diff output engine.
7
8 '
9 . ./test-lib.sh
10 -. ../diff-lib.sh
10 +. "$TEST_DIRECTORY"/diff-lib.sh
11
12 echo >path0 'Line 1
13 Line 2
t/t4001-diff-rename.sh
+1 -1
@@ -7,7 +7,7 @@ test_description='Test rename detection in diff engine.
7
8 '
9 . ./test-lib.sh
10 -. ../diff-lib.sh
10 +. "$TEST_DIRECTORY"/diff-lib.sh
11
12 echo >path0 'Line 1
13 Line 2
t/t4002-diff-basic.sh
+1 -1
@@ -7,7 +7,7 @@ test_description='Test diff raw-output.
7
8 '
9 . ./test-lib.sh
10 -. ../lib-read-tree-m-3way.sh
10 +. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh
11
12 cat >.test-plain-OA <<\EOF
13 :000000 100644 0000000000000000000000000000000000000000 ccba72ad3888a3520b39efcf780b9ee64167535d A AA
t/t4003-diff-rename-1.sh
+3 -3
@@ -7,11 +7,11 @@ test_description='More rename detection
7
8 '
9 . ./test-lib.sh
10 -. ../diff-lib.sh ;# test-lib chdir's into trash
10 +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
11
12 test_expect_success \
13 'prepare reference tree' \
14 - 'cat ../../COPYING >COPYING &&
14 + 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
15 echo frotz >rezrov &&
16 git update-index --add COPYING rezrov &&
17 tree=$(git write-tree) &&
@@ -99,7 +99,7 @@ test_expect_success \
99
100 test_expect_success \
101 'prepare work tree once again' \
102 - 'cat ../../COPYING >COPYING &&
102 + 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
103 git update-index --add --remove COPYING COPYING.1'
104
105 # tree has COPYING and rezrov. work tree has COPYING and COPYING.1,
t/t4004-diff-rename-symlink.sh
+1 -1
@@ -10,7 +10,7 @@ copy of symbolic links, but should not produce rename/copy followed
10 by an edit for them.
11 '
12 . ./test-lib.sh
13 -. ../diff-lib.sh
13 +. "$TEST_DIRECTORY"/diff-lib.sh
14
15 test_expect_success \
16 'prepare reference tree' \
t/t4005-diff-rename-2.sh
+3 -3
@@ -7,11 +7,11 @@ test_description='Same rename detection as t4003 but testing diff-raw.
7
8 '
9 . ./test-lib.sh
10 -. ../diff-lib.sh ;# test-lib chdir's into trash
10 +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
11
12 test_expect_success \
13 'prepare reference tree' \
14 - 'cat ../../COPYING >COPYING &&
14 + 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
15 echo frotz >rezrov &&
16 git update-index --add COPYING rezrov &&
17 tree=$(git write-tree) &&
@@ -71,7 +71,7 @@ test_expect_success \
71
72 test_expect_success \
73 'prepare work tree once again' \
74 - 'cat ../../COPYING >COPYING &&
74 + 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
75 git update-index --add --remove COPYING COPYING.1'
76
77 git diff-index -C --find-copies-harder $tree >current
t/t4007-rename-3.sh
+2 -2
@@ -7,12 +7,12 @@ test_description='Rename interaction with pathspec.
7
8 '
9 . ./test-lib.sh
10 -. ../diff-lib.sh ;# test-lib chdir's into trash
10 +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
11
12 test_expect_success \
13 'prepare reference tree' \
14 'mkdir path0 path1 &&
15 - cp ../../COPYING path0/COPYING &&
15 + cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
16 git update-index --add path0/COPYING &&
17 tree=$(git write-tree) &&
18 echo $tree'
t/t4008-diff-break-rewrite.sh
+3 -3
@@ -22,12 +22,12 @@ four changes in total.
22 Further, with -B and -M together, these should turn into two renames.
23 '
24 . ./test-lib.sh
25 -. ../diff-lib.sh ;# test-lib chdir's into trash
25 +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
26
27 test_expect_success \
28 setup \
29 - 'cat ../../README >file0 &&
30 - cat ../../COPYING >file1 &&
29 + 'cat "$TEST_DIRECTORY"/../README >file0 &&
30 + cat "$TEST_DIRECTORY"/../COPYING >file1 &&
31 git update-index --add file0 file1 &&
32 tree=$(git write-tree) &&
33 echo "$tree"'
t/t4009-diff-rename-4.sh
+3 -3
@@ -7,11 +7,11 @@ test_description='Same rename detection as t4003 but testing diff-raw -z.
7
8 '
9 . ./test-lib.sh
10 -. ../diff-lib.sh ;# test-lib chdir's into trash
10 +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
11
12 test_expect_success \
13 'prepare reference tree' \
14 - 'cat ../../COPYING >COPYING &&
14 + 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
15 echo frotz >rezrov &&
16 git update-index --add COPYING rezrov &&
17 tree=$(git write-tree) &&
@@ -78,7 +78,7 @@ test_expect_success \
78
79 test_expect_success \
80 'prepare work tree once again' \
81 - 'cat ../../COPYING >COPYING &&
81 + 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
82 git update-index --add --remove COPYING COPYING.1'
83
84 git diff-index -z -C --find-copies-harder $tree >current
t/t4010-diff-pathspec.sh
+1 -1
@@ -10,7 +10,7 @@ Prepare:
10 path1/file1
11 '
12 . ./test-lib.sh
13 -. ../diff-lib.sh ;# test-lib chdir's into trash
13 +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
14
15 test_expect_success \
16 setup \
t/t4011-diff-symlink.sh
+1 -1
@@ -7,7 +7,7 @@ test_description='Test diff of symlinks.
7
8 '
9 . ./test-lib.sh
10 -. ../diff-lib.sh
10 +. "$TEST_DIRECTORY"/diff-lib.sh
11
12 cat > expected << EOF
13 diff --git a/frotz b/frotz
t/t4012-diff-binary.sh
+1 -1
@@ -12,7 +12,7 @@ test_expect_success 'prepare repository' \
12 'echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&
13 git update-index --add a b c d &&
14 echo git >a &&
15 - cat ../test4012.png >b &&
15 + cat "$TEST_DIRECTORY"/test4012.png >b &&
16 echo git >c &&
17 cat b b >d'
18
t/t4013-diff-various.sh
+1 -1
@@ -99,7 +99,7 @@ do
99 test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'`
100 cnt=`expr $test_count + 1`
101 pfx=`printf "%04d" $cnt`
102 - expect="../t4013/diff.$test"
102 + expect="$TEST_DIRECTORY/t4013/diff.$test"
103 actual="$pfx-diff.$test"
104
105 test_expect_success "git $cmd" '
t/t4015-diff-whitespace.sh
+1 -1
@@ -7,7 +7,7 @@ test_description='Test special whitespace in diff engine.
7
8 '
9 . ./test-lib.sh
10 -. ../diff-lib.sh
10 +. "$TEST_DIRECTORY"/diff-lib.sh
11
12 # Ray Lehtiniemi's example
13
t/t4020-diff-external.sh
+1 -1
@@ -104,7 +104,7 @@ echo NULZbetweenZwords | perl -pe 'y/Z/\000/' > file
104 test_expect_success 'force diff with "diff"' '
105 echo >.gitattributes "file diff" &&
106 git diff >actual &&
107 - test_cmp ../t4020/diff.NUL actual
107 + test_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual
108 '
109
110 test_done
t/t4022-diff-rewrite.sh
+2 -2
@@ -6,12 +6,12 @@ test_description='rewrite diff'
6
7 test_expect_success setup '
8
9 - cat ../../COPYING >test &&
9 + cat "$TEST_DIRECTORY"/../COPYING >test &&
10 git add test &&
11 tr \
12 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \
13 "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \
14 - <../../COPYING >test
14 + <"$TEST_DIRECTORY"/../COPYING >test
15
16 '
17
t/t4023-diff-rename-typechange.sh
+7 -7
@@ -7,21 +7,21 @@ test_description='typechange rename detection'
7 test_expect_success setup '
8
9 rm -f foo bar &&
10 - cat ../../COPYING >foo &&
10 + cat "$TEST_DIRECTORY"/../COPYING >foo &&
11 ln -s linklink bar &&
12 git add foo bar &&
13 git commit -a -m Initial &&
14 git tag one &&
15
16 rm -f foo bar &&
17 - cat ../../COPYING >bar &&
17 + cat "$TEST_DIRECTORY"/../COPYING >bar &&
18 ln -s linklink foo &&
19 git add foo bar &&
20 git commit -a -m Second &&
21 git tag two &&
22
23 rm -f foo bar &&
24 - cat ../../COPYING >foo &&
24 + cat "$TEST_DIRECTORY"/../COPYING >foo &&
25 git add foo &&
26 git commit -a -m Third &&
27 git tag three &&
@@ -35,15 +35,15 @@ test_expect_success setup '
35 # This is purely for sanity check
36
37 rm -f foo bar &&
38 - cat ../../COPYING >foo &&
39 - cat ../../Makefile >bar &&
38 + cat "$TEST_DIRECTORY"/../COPYING >foo &&
39 + cat "$TEST_DIRECTORY"/../Makefile >bar &&
40 git add foo bar &&
41 git commit -a -m Fifth &&
42 git tag five &&
43
44 rm -f foo bar &&
45 - cat ../../Makefile >foo &&
46 - cat ../../COPYING >bar &&
45 + cat "$TEST_DIRECTORY"/../Makefile >foo &&
46 + cat "$TEST_DIRECTORY"/../COPYING >bar &&
47 git add foo bar &&
48 git commit -a -m Sixth &&
49 git tag six
t/t4027-diff-submodule.sh
+1 -1
@@ -3,7 +3,7 @@
3 test_description='difference in submodules'
4
5 . ./test-lib.sh
6 -. ../diff-lib.sh
6 +. "$TEST_DIRECTORY"/diff-lib.sh
7
8 _z40=0000000000000000000000000000000000000000
9 test_expect_success setup '
t/t4100-apply-stat.sh
+2 -2
@@ -17,13 +17,13 @@ do
17 test_expect_success "$title" '
18 git apply --stat --summary \
19 <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" >current &&
20 - test_cmp ../t4100/t-apply-$num.expect current
20 + test_cmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
21 '
22
23 test_expect_success "$title with recount" '
24 sed -e "$UNC" <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" |
25 git apply --recount --stat --summary >current &&
26 - test_cmp ../t4100/t-apply-$num.expect current
26 + test_cmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
27 '
28 done <<\EOF
29 rename
t/t4101-apply-nonl.sh
+4 -3
@@ -21,9 +21,10 @@ do
21 do
22 test $i -eq $j && continue
23 cat frotz.$i >frotz
24 - test_expect_success \
25 - "apply diff between $i and $j" \
26 - "git apply <../t4101/diff.$i-$j && diff frotz.$j frotz"
24 + test_expect_success "apply diff between $i and $j" '
25 + git apply <"$TEST_DIRECTORY"/t4101/diff.$i-$j &&
26 + test_cmp frotz.$j frotz
27 + '
28 done
29 done
30
t/t5100-mailinfo.sh
+12 -11
@@ -8,27 +8,28 @@ test_description='git mailinfo and git mailsplit test'
8 . ./test-lib.sh
9
10 test_expect_success 'split sample box' \
11 - 'git mailsplit -o. ../t5100/sample.mbox >last &&
11 + 'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last &&
12 last=`cat last` &&
13 echo total is $last &&
14 test `cat last` = 11'
15
16 for mail in `echo 00*`
17 do
18 - test_expect_success "mailinfo $mail" \
19 - "git mailinfo -u msg$mail patch$mail <$mail >info$mail &&
18 + test_expect_success "mailinfo $mail" '
19 + git mailinfo -u msg$mail patch$mail <$mail >info$mail &&
20 echo msg &&
21 - diff ../t5100/msg$mail msg$mail &&
21 + test_cmp "$TEST_DIRECTORY"/t5100/msg$mail msg$mail &&
22 echo patch &&
23 - diff ../t5100/patch$mail patch$mail &&
23 + test_cmp "$TEST_DIRECTORY"/t5100/patch$mail patch$mail &&
24 echo info &&
25 - diff ../t5100/info$mail info$mail"
25 + test_cmp "$TEST_DIRECTORY"/t5100/info$mail info$mail
26 + '
27 done
28
29 test_expect_success 'respect NULs' '
30
30 - git mailsplit -d3 -o. ../t5100/nul-plain &&
31 - cmp ../t5100/nul-plain 001 &&
31 + git mailsplit -d3 -o. "$TEST_DIRECTORY"/t5100/nul-plain &&
32 + test_cmp "$TEST_DIRECTORY"/t5100/nul-plain 001 &&
33 (cat 001 | git mailinfo msg patch) &&
34 test 4 = $(wc -l < patch)
35
@@ -36,10 +37,10 @@ test_expect_success 'respect NULs' '
37
38 test_expect_success 'Preserve NULs out of MIME encoded message' '
39
39 - git mailsplit -d5 -o. ../t5100/nul-b64.in &&
40 - cmp ../t5100/nul-b64.in 00001 &&
40 + git mailsplit -d5 -o. "$TEST_DIRECTORY"/t5100/nul-b64.in &&
41 + test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.in 00001 &&
42 git mailinfo msg patch <00001 &&
42 - cmp ../t5100/nul-b64.expect patch
43 + test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.expect patch
44
45 '
46
t/t5515-fetch-merge-logic.sh
+2 -2
@@ -131,9 +131,9 @@ do
131 test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'`
132 cnt=`expr $test_count + 1`
133 pfx=`printf "%04d" $cnt`
134 - expect_f="../../t5515/fetch.$test"
134 + expect_f="$TEST_DIRECTORY/t5515/fetch.$test"
135 actual_f="$pfx-fetch.$test"
136 - expect_r="../../t5515/refs.$test"
136 + expect_r="$TEST_DIRECTORY/t5515/refs.$test"
137 actual_r="$pfx-refs.$test"
138
139 test_expect_success "$cmd" '
t/t5540-http-push.sh
+1 -1
@@ -19,7 +19,7 @@ then
19 exit
20 fi
21
22 -. ../lib-httpd.sh
22 +. "$TEST_DIRECTORY"/lib-httpd.sh
23
24 if ! start_httpd >&3 2>&4
25 then
t/t6002-rev-list-bisect.sh
+1 -1
@@ -5,7 +5,7 @@
5 test_description='Tests git rev-list --bisect functionality'
6
7 . ./test-lib.sh
8 -. ../t6000lib.sh # t6xxx specific functions
8 +. "$TEST_DIRECTORY"/t6000lib.sh # t6xxx specific functions
9
10 # usage: test_bisection max-diff bisect-option head ^prune...
11 #
t/t6003-rev-list-topo-order.sh
+1 -1
@@ -6,7 +6,7 @@
6 test_description='Tests git rev-list --topo-order functionality'
7
8 . ./test-lib.sh
9 -. ../t6000lib.sh # t6xxx specific functions
9 +. "$TEST_DIRECTORY"/t6000lib.sh # t6xxx specific functions
10
11 list_duplicates()
12 {
t/t6023-merge-file.sh
+1 -1
@@ -136,7 +136,7 @@ test_expect_success "expected conflict markers" "test_cmp expect out"
136
137 test_expect_success 'binary files cannot be merged' '
138 test_must_fail git merge-file -p \
139 - orig.txt ../test4012.png new1.txt 2> merge.err &&
139 + orig.txt "$TEST_DIRECTORY"/test4012.png new1.txt 2> merge.err &&
140 grep "Cannot merge binary files" merge.err
141 '
142
t/t6027-merge-binary.sh
+1 -1
@@ -6,7 +6,7 @@ test_description='ask merge-recursive to merge binary files'
6
7 test_expect_success setup '
8
9 - cat ../test4012.png >m &&
9 + cat "$TEST_DIRECTORY"/test4012.png >m &&
10 git add m &&
11 git ls-files -s | sed -e "s/ 0 / 1 /" >E1 &&
12 test_tick &&
t/t6101-rev-parse-parents.sh
+1 -1
@@ -6,7 +6,7 @@
6 test_description='Test git rev-parse with different parent options'
7
8 . ./test-lib.sh
9 -. ../t6000lib.sh # t6xxx specific functions
9 +. "$TEST_DIRECTORY"/t6000lib.sh # t6xxx specific functions
10
11 date >path0
12 git update-index --add path0
t/t6200-fmt-merge-msg.sh
+2 -2
@@ -83,13 +83,13 @@ test_expect_success 'merge-msg test #1' '
83 '
84
85 cat >expected <<EOF
86 -Merge branch 'left' of ../$test
86 +Merge branch 'left' of $TEST_DIRECTORY/$test
87 EOF
88
89 test_expect_success 'merge-msg test #2' '
90
91 git checkout master &&
92 - git fetch ../"$test" left &&
92 + git fetch "$TEST_DIRECTORY/$test" left &&
93
94 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
95 test_cmp expected actual
t/t7001-mv.sh
+2 -2
@@ -6,7 +6,7 @@ test_description='git mv in subdirs'
6 test_expect_success \
7 'prepare reference tree' \
8 'mkdir path0 path1 &&
9 - cp ../../COPYING path0/COPYING &&
9 + cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
10 git add path0/COPYING &&
11 git-commit -m add -a'
12
@@ -40,7 +40,7 @@ test_expect_success \
40
41 test_expect_success \
42 'adding another file' \
43 - 'cp ../../README path0/README &&
43 + 'cp "$TEST_DIRECTORY"/../README path0/README &&
44 git add path0/README &&
45 git-commit -m add2 -a'
46
t/t7004-tag.sh
+1 -1
@@ -625,7 +625,7 @@ esac
625 # Name and email: C O Mitter <committer@example.com>
626 # No password given, to enable non-interactive operation.
627
628 -cp -R ../t7004 ./gpghome
628 +cp -R "$TEST_DIRECTORY"/t7004 ./gpghome
629 chmod 0700 gpghome
630 GNUPGHOME="$(pwd)/gpghome"
631 export GNUPGHOME
t/t7101-reset.sh
+5 -5
@@ -9,7 +9,7 @@ test_description='git-reset should cull empty subdirs'
9 test_expect_success \
10 'creating initial files' \
11 'mkdir path0 &&
12 - cp ../../COPYING path0/COPYING &&
12 + cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
13 git add path0/COPYING &&
14 git-commit -m add -a'
15
@@ -17,10 +17,10 @@ test_expect_success \
17 'creating second files' \
18 'mkdir path1 &&
19 mkdir path1/path2 &&
20 - cp ../../COPYING path1/path2/COPYING &&
21 - cp ../../COPYING path1/COPYING &&
22 - cp ../../COPYING COPYING &&
23 - cp ../../COPYING path0/COPYING-TOO &&
20 + cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
21 + cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
22 + cp "$TEST_DIRECTORY"/../COPYING COPYING &&
23 + cp "$TEST_DIRECTORY"/../COPYING path0/COPYING-TOO &&
24 git add path1/path2/COPYING &&
25 git add path1/COPYING &&
26 git add COPYING &&
t/t7500-commit.sh
+30 -11
@@ -46,15 +46,24 @@ test_expect_success 'unedited template with comments should not commit' '
46 '
47
48 test_expect_success 'a Signed-off-by line by itself should not commit' '
49 - ! GIT_EDITOR=../t7500/add-signed-off git commit --template "$TEMPLATE"
49 + (
50 + test_set_editor "$TEST_DIRECTORY"/t7500/add-signed-off &&
51 + test_must_fail git commit --template "$TEMPLATE"
52 + )
53 '
54
55 test_expect_success 'adding comments to a template should not commit' '
53 - ! GIT_EDITOR=../t7500/add-comments git commit --template "$TEMPLATE"
56 + (
57 + test_set_editor "$TEST_DIRECTORY"/t7500/add-comments &&
58 + test_must_fail git commit --template "$TEMPLATE"
59 + )
60 '
61
62 test_expect_success 'adding real content to a template should commit' '
57 - GIT_EDITOR=../t7500/add-content git commit --template "$TEMPLATE" &&
63 + (
64 + test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
65 + git commit --template "$TEMPLATE"
66 + ) &&
67 commit_msg_is "template linecommit message"
68 '
69
@@ -62,7 +71,10 @@ test_expect_success '-t option should be short for --template' '
71 echo "short template" > "$TEMPLATE" &&
72 echo "new content" >> foo &&
73 git add foo &&
65 - GIT_EDITOR=../t7500/add-content git commit -t "$TEMPLATE" &&
74 + (
75 + test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
76 + git commit -t "$TEMPLATE"
77 + ) &&
78 commit_msg_is "short templatecommit message"
79 '
80
@@ -71,7 +83,10 @@ test_expect_success 'config-specified template should commit' '
83 git config commit.template "$TEMPLATE" &&
84 echo "more content" >> foo &&
85 git add foo &&
74 - GIT_EDITOR=../t7500/add-content git commit &&
86 + (
87 + test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
88 + git commit
89 + ) &&
90 git config --unset commit.template &&
91 commit_msg_is "new templatecommit message"
92 '
@@ -79,7 +94,7 @@ test_expect_success 'config-specified template should commit' '
94 test_expect_success 'explicit commit message should override template' '
95 echo "still more content" >> foo &&
96 git add foo &&
82 - GIT_EDITOR=../t7500/add-content git commit --template "$TEMPLATE" \
97 + GIT_EDITOR="$TEST_DIRECTORY"/t7500/add-content git commit --template "$TEMPLATE" \
98 -m "command line msg" &&
99 commit_msg_is "command line msg"
100 '
@@ -88,8 +103,10 @@ test_expect_success 'commit message from file should override template' '
103 echo "content galore" >> foo &&
104 git add foo &&
105 echo "standard input msg" |
91 - GIT_EDITOR=../t7500/add-content git commit \
92 - --template "$TEMPLATE" --file - &&
106 + (
107 + test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
108 + git commit --template "$TEMPLATE" --file -
109 + ) &&
110 commit_msg_is "standard input msg"
111 '
112
@@ -132,10 +149,12 @@ EOF
149
150 test_expect_success '--signoff' '
151 echo "yet another content *narf*" >> foo &&
135 - echo "zort" |
136 - GIT_EDITOR=../t7500/add-content git commit -s -F - foo &&
152 + echo "zort" | (
153 + test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
154 + git commit -s -F - foo
155 + ) &&
156 git cat-file commit HEAD | sed "1,/^$/d" > output &&
138 - diff expect output
157 + test_cmp expect output
158 '
159
160 test_expect_success 'commit message from file (1)' '
t/t8001-annotate.sh
+1 -1
@@ -4,7 +4,7 @@ test_description='git annotate'
4 . ./test-lib.sh
5
6 PROG='git annotate'
7 -. ../annotate-tests.sh
7 +. "$TEST_DIRECTORY"/annotate-tests.sh
8
9 test_expect_success \
10 'Annotating an old revision works' \
t/t8002-blame.sh
+1 -1
@@ -4,6 +4,6 @@ test_description='git blame'
4 . ./test-lib.sh
5
6 PROG='git blame -c'
7 -. ../annotate-tests.sh
7 +. "$TEST_DIRECTORY"/annotate-tests.sh
8
9 test_done
t/t9110-git-svn-use-svm-props.sh
+1 -1
@@ -8,7 +8,7 @@ test_description='git-svn useSvmProps test'
8 . ./lib-git-svn.sh
9
10 test_expect_success 'load svm repo' '
11 - svnadmin load -q "$rawsvnrepo" < ../t9110/svm.dump &&
11 + svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9110/svm.dump &&
12 git-svn init --minimize-url -R arr -i bar "$svnrepo"/mirror/arr &&
13 git-svn init --minimize-url -R argh -i dir "$svnrepo"/mirror/argh &&
14 git-svn init --minimize-url -R argh -i e \
t/t9111-git-svn-use-svnsync-props.sh
+1 -1
@@ -8,7 +8,7 @@ test_description='git-svn useSvnsyncProps test'
8 . ./lib-git-svn.sh
9
10 test_expect_success 'load svnsync repo' '
11 - svnadmin load -q "$rawsvnrepo" < ../t9111/svnsync.dump &&
11 + svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9111/svnsync.dump &&
12 git-svn init --minimize-url -R arr -i bar "$svnrepo"/bar &&
13 git-svn init --minimize-url -R argh -i dir "$svnrepo"/dir &&
14 git-svn init --minimize-url -R argh -i e "$svnrepo"/dir/a/b/c/d/e &&
t/t9115-git-svn-dcommit-funky-renames.sh
+1 -1
@@ -8,7 +8,7 @@ test_description='git-svn dcommit can commit renames of files with ugly names'
8 . ./lib-git-svn.sh
9
10 test_expect_success 'load repository with strange names' '
11 - svnadmin load -q "$rawsvnrepo" < ../t9115/funky-names.dump &&
11 + svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9115/funky-names.dump &&
12 start_httpd gtk+
13 '
14
t/t9121-git-svn-fetch-renamed-dir.sh
+1 -1
@@ -8,7 +8,7 @@ test_description='git-svn can fetch renamed directories'
8 . ./lib-git-svn.sh
9
10 test_expect_success 'load repository with renamed directory' '
11 - svnadmin load -q "$rawsvnrepo" < ../t9121/renamed-dir.dump
11 + svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9121/renamed-dir.dump
12 '
13
14 test_expect_success 'init and fetch repository' '
t/t9200-git-cvsexportcommit.sh
+7 -7
@@ -45,8 +45,8 @@ test_expect_success \
45 'mkdir A B C D E F &&
46 echo hello1 >A/newfile1.txt &&
47 echo hello2 >B/newfile2.txt &&
48 - cp ../test9200a.png C/newfile3.png &&
49 - cp ../test9200a.png D/newfile4.png &&
48 + cp "$TEST_DIRECTORY"/test9200a.png C/newfile3.png &&
49 + cp "$TEST_DIRECTORY"/test9200a.png D/newfile4.png &&
50 git add A/newfile1.txt &&
51 git add B/newfile2.txt &&
52 git add C/newfile3.png &&
@@ -71,8 +71,8 @@ test_expect_success \
71 rm -f B/newfile2.txt &&
72 rm -f C/newfile3.png &&
73 echo Hello5 >E/newfile5.txt &&
74 - cp ../test9200b.png D/newfile4.png &&
75 - cp ../test9200a.png F/newfile6.png &&
74 + cp "$TEST_DIRECTORY"/test9200b.png D/newfile4.png &&
75 + cp "$TEST_DIRECTORY"/test9200a.png F/newfile6.png &&
76 git add E/newfile5.txt &&
77 git add F/newfile6.png &&
78 git commit -a -m "Test: Remove, add and update" &&
@@ -160,7 +160,7 @@ test_expect_success \
160 'mkdir "G g" &&
161 echo ok then >"G g/with spaces.txt" &&
162 git add "G g/with spaces.txt" && \
163 - cp ../test9200a.png "G g/with spaces.png" && \
163 + cp "$TEST_DIRECTORY"/test9200a.png "G g/with spaces.png" && \
164 git add "G g/with spaces.png" &&
165 git commit -a -m "With spaces" &&
166 id=$(git rev-list --max-count=1 HEAD) &&
@@ -172,7 +172,7 @@ test_expect_success \
172 test_expect_success \
173 'Update file with spaces in file name' \
174 'echo Ok then >>"G g/with spaces.txt" &&
175 - cat ../test9200a.png >>"G g/with spaces.png" && \
175 + cat "$TEST_DIRECTORY"/test9200a.png >>"G g/with spaces.png" && \
176 git add "G g/with spaces.png" &&
177 git commit -a -m "Update with spaces" &&
178 id=$(git rev-list --max-count=1 HEAD) &&
@@ -197,7 +197,7 @@ test_expect_success \
197 'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
198 echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
199 git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
200 - cp ../test9200a.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
200 + cp "$TEST_DIRECTORY"/test9200a.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
201 git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
202 git commit -a -m "Går det så går det" && \
203 id=$(git rev-list --max-count=1 HEAD) &&
t/t9300-fast-import.sh
+1 -1
@@ -5,7 +5,7 @@
5
6 test_description='test git-fast-import utility'
7 . ./test-lib.sh
8 -. ../diff-lib.sh ;# test-lib chdir's into trash
8 +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
9
10 file2_data='file2
11 second line of EOF'
t/t9301-fast-export.sh
+1 -1
@@ -67,7 +67,7 @@ test_expect_success 'iso-8859-1' '
67
68 git config i18n.commitencoding ISO-8859-1 &&
69 # use author and committer name in ISO-8859-1 to match it.
70 - . ../t3901-8859-1.txt &&
70 + . "$TEST_DIRECTORY"/t3901-8859-1.txt &&
71 test_tick &&
72 echo rosten >file &&
73 git commit -s -m den file &&
t/t9500-gitweb-standalone-no-errors.sh
+8 -8
@@ -25,9 +25,9 @@ our \$site_name = "[localhost]";
25 our \$site_header = "";
26 our \$site_footer = "";
27 our \$home_text = "indextext.html";
28 -our @stylesheets = ("file:///$safe_pwd/../../gitweb/gitweb.css");
29 -our \$logo = "file:///$safe_pwd/../../gitweb/git-logo.png";
30 -our \$favicon = "file:///$safe_pwd/../../gitweb/git-favicon.png";
28 +our @stylesheets = ("file:///$TEST_DIRECTORY/../gitweb/gitweb.css");
29 +our \$logo = "file:///$TEST_DIRECTORY/../gitweb/git-logo.png";
30 +our \$favicon = "file:///$TEST_DIRECTORY/../gitweb/git-favicon.png";
31 our \$projects_list = "";
32 our \$export_ok = "";
33 our \$strict_export = "";
@@ -54,7 +54,7 @@ gitweb_run () {
54 # written to web server logs, so we are not interested in that:
55 # we are interested only in properly formatted errors/warnings
56 rm -f gitweb.log &&
57 - perl -- "$(pwd)/../../gitweb/gitweb.perl" \
57 + perl -- "$TEST_DIRECTORY/../gitweb/gitweb.perl" \
58 >/dev/null 2>gitweb.log &&
59 if grep -q -s "^[[]" gitweb.log >/dev/null; then false; else true; fi
60
@@ -525,20 +525,20 @@ test_debug 'cat gitweb.log'
525
526 test_expect_success \
527 'encode(commit): utf8' \
528 - '. ../t3901-utf8.txt &&
528 + '. "$TEST_DIRECTORY"/t3901-utf8.txt &&
529 echo "UTF-8" >> file &&
530 git add file &&
531 - git commit -F ../t3900/1-UTF-8.txt &&
531 + git commit -F "$TEST_DIRECTORY"/t3900/1-UTF-8.txt &&
532 gitweb_run "p=.git;a=commit"'
533 test_debug 'cat gitweb.log'
534
535 test_expect_success \
536 'encode(commit): iso-8859-1' \
537 - '. ../t3901-8859-1.txt &&
537 + '. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
538 echo "ISO-8859-1" >> file &&
539 git add file &&
540 git config i18n.commitencoding ISO-8859-1 &&
541 - git commit -F ../t3900/ISO-8859-1.txt &&
541 + git commit -F "$TEST_DIRECTORY"/t3900/ISO-8859-1.txt &&
542 git config --unset i18n.commitencoding &&
543 gitweb_run "p=.git;a=commit"'
544 test_debug 'cat gitweb.log'
t/t9700-perl-git.sh
+1 -1
@@ -39,6 +39,6 @@ test_expect_success \
39
40 test_external_without_stderr \
41 'Perl API' \
42 - perl ../t9700/test.pl
42 + perl "$TEST_DIRECTORY"/t9700/test.pl
43
44 test_done
t/t9700/test.pl
-3
@@ -14,10 +14,7 @@ use File::Temp;
14 BEGIN { use_ok('Git') }
15
16 # set up
17 -our $repo_dir = "trash directory";
17 our $abs_repo_dir = Cwd->cwd;
19 -die "this must be run by calling the t/t97* shell script(s)\n"
20 - if basename(Cwd->cwd) ne $repo_dir;
18 ok(our $r = Git->repository(Directory => "."), "open repository");
19
20 # config
t/test-lib.sh
+1 -1
@@ -406,7 +406,7 @@ test_create_repo () {
406 error "bug in the test script: not 1 parameter to test-create-repo"
407 owd=`pwd`
408 repo="$1"
409 - mkdir "$repo"
409 + mkdir -p "$repo"
410 cd "$repo" || error "Cannot setup test environment"
411 "$GIT_EXEC_PATH/git" init "--template=$GIT_EXEC_PATH/templates/blt/" >&3 2>&4 ||
412 error "cannot run git init -- have you built things yet?"