提交 bfdbee98 编写于 作者: J Junio C Hamano

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: NJunio C Hamano <gitster@pobox.com>
上级 053fd0c1
......@@ -14,7 +14,7 @@ fi
LIB_HTTPD_PATH=${LIB_HTTPD_PATH-'/usr/sbin/apache2'}
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'}
TEST_PATH="$PWD"/../lib-httpd
TEST_PATH="$TEST_DIRECTORY"/lib-httpd
HTTPD_ROOT_PATH="$PWD"/httpd
HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www
......
......@@ -6,13 +6,13 @@ test_description='ignore CR in CRLF sequence while computing similiarity'
test_expect_success setup '
cat ../t0022-crlf-rename.sh >sample &&
cat "$TEST_DIRECTORY"/t0022-crlf-rename.sh >sample &&
git add sample &&
test_tick &&
git commit -m Initial &&
sed -e "s/\$/ /" ../t0022-crlf-rename.sh >elpmas &&
sed -e "s/\$/ /" "$TEST_DIRECTORY"/t0022-crlf-rename.sh >elpmas &&
git add elpmas &&
rm -f sample &&
......
......@@ -72,7 +72,7 @@ In addition:
'
. ./test-lib.sh
. ../lib-read-tree-m-3way.sh
. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh
################################################################
# Trivial "majority when 3 stages exist" merge plus #2ALT, #3ALT
......
......@@ -16,7 +16,7 @@ test_expect_success setup '
: >F &&
git add F &&
T=$(git write-tree) &&
C=$(git commit-tree $T <../t3900/1-UTF-8.txt) &&
C=$(git commit-tree $T <"$TEST_DIRECTORY"/t3900/1-UTF-8.txt) &&
git update-ref HEAD $C &&
git-tag C0
'
......@@ -32,7 +32,7 @@ do
git config i18n.commitencoding $H &&
git-checkout -b $H C0 &&
echo $H >F &&
git-commit -a -F ../t3900/$H.txt
git-commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt
'
done
......@@ -57,13 +57,13 @@ test_expect_success 'config to remove customization' '
'
test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' '
compare_with ISO-8859-1 ../t3900/1-UTF-8.txt
compare_with ISO-8859-1 "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
'
for H in EUCJP ISO-2022-JP
do
test_expect_success "$H should be shown in UTF-8 now" '
compare_with '$H' ../t3900/2-UTF-8.txt
compare_with '$H' "$TEST_DIRECTORY"/t3900/2-UTF-8.txt
'
done
......@@ -82,7 +82,7 @@ for H in ISO-8859-1 EUCJP ISO-2022-JP
do
test_expect_success "$H should be shown in itself now" '
git config i18n.commitencoding '$H' &&
compare_with '$H' ../t3900/'$H'.txt
compare_with '$H' "$TEST_DIRECTORY"/t3900/'$H'.txt
'
done
......@@ -91,13 +91,13 @@ test_expect_success 'config to tweak customization' '
'
test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' '
compare_with ISO-8859-1 ../t3900/1-UTF-8.txt
compare_with ISO-8859-1 "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
'
for H in EUCJP ISO-2022-JP
do
test_expect_success "$H should be shown in UTF-8 now" '
compare_with '$H' ../t3900/2-UTF-8.txt
compare_with '$H' "$TEST_DIRECTORY"/t3900/2-UTF-8.txt
'
done
......@@ -107,7 +107,7 @@ do
for H in EUCJP ISO-2022-JP
do
test_expect_success "$H should be shown in $J now" '
compare_with '$H' ../t3900/'$J'.txt
compare_with '$H' "$TEST_DIRECTORY"/t3900/'$J'.txt
'
done
done
......@@ -115,7 +115,7 @@ done
for H in ISO-8859-1 EUCJP ISO-2022-JP
do
test_expect_success "No conversion with $H" '
compare_with "--encoding=none '$H'" ../t3900/'$H'.txt
compare_with "--encoding=none '$H'" "$TEST_DIRECTORY"/t3900/'$H'.txt
'
done
......
......@@ -35,7 +35,7 @@ test_expect_success setup '
# use UTF-8 in author and committer name to match the
# i18n.commitencoding settings
. ../t3901-utf8.txt &&
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
test_tick &&
echo "$GIT_AUTHOR_NAME" >mine &&
......@@ -57,7 +57,7 @@ test_expect_success setup '
# the second one on the side branch is ISO-8859-1
git config i18n.commitencoding ISO-8859-1 &&
# use author and committer name in ISO-8859-1 to match it.
. ../t3901-8859-1.txt &&
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
test_tick &&
echo Yet another >theirs &&
git add theirs &&
......@@ -101,7 +101,7 @@ test_expect_success 'rebase (U/U)' '
# The result will be committed by GIT_COMMITTER_NAME --
# we want UTF-8 encoded name.
. ../t3901-utf8.txt &&
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
git checkout -b test &&
git-rebase master &&
......@@ -111,7 +111,7 @@ test_expect_success 'rebase (U/U)' '
test_expect_success 'rebase (U/L)' '
git config i18n.commitencoding UTF-8 &&
git config i18n.logoutputencoding ISO-8859-1 &&
. ../t3901-utf8.txt &&
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
git reset --hard side &&
git-rebase master &&
......@@ -123,7 +123,7 @@ test_expect_success 'rebase (L/L)' '
# In this test we want ISO-8859-1 encoded commits as the result
git config i18n.commitencoding ISO-8859-1 &&
git config i18n.logoutputencoding ISO-8859-1 &&
. ../t3901-8859-1.txt &&
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
git reset --hard side &&
git-rebase master &&
......@@ -136,7 +136,7 @@ test_expect_success 'rebase (L/U)' '
# to get ISO-8859-1 results.
git config i18n.commitencoding ISO-8859-1 &&
git config i18n.logoutputencoding UTF-8 &&
. ../t3901-8859-1.txt &&
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
git reset --hard side &&
git-rebase master &&
......@@ -149,7 +149,7 @@ test_expect_success 'cherry-pick(U/U)' '
git config i18n.commitencoding UTF-8 &&
git config i18n.logoutputencoding UTF-8 &&
. ../t3901-utf8.txt &&
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
git reset --hard master &&
git cherry-pick side^ &&
......@@ -164,7 +164,7 @@ test_expect_success 'cherry-pick(L/L)' '
git config i18n.commitencoding ISO-8859-1 &&
git config i18n.logoutputencoding ISO-8859-1 &&
. ../t3901-8859-1.txt &&
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
git reset --hard master &&
git cherry-pick side^ &&
......@@ -179,7 +179,7 @@ test_expect_success 'cherry-pick(U/L)' '
git config i18n.commitencoding UTF-8 &&
git config i18n.logoutputencoding ISO-8859-1 &&
. ../t3901-utf8.txt &&
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
git reset --hard master &&
git cherry-pick side^ &&
......@@ -195,7 +195,7 @@ test_expect_success 'cherry-pick(L/U)' '
git config i18n.commitencoding ISO-8859-1 &&
git config i18n.logoutputencoding UTF-8 &&
. ../t3901-8859-1.txt &&
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
git reset --hard master &&
git cherry-pick side^ &&
......@@ -208,7 +208,7 @@ test_expect_success 'cherry-pick(L/U)' '
test_expect_success 'rebase --merge (U/U)' '
git config i18n.commitencoding UTF-8 &&
git config i18n.logoutputencoding UTF-8 &&
. ../t3901-utf8.txt &&
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
git reset --hard side &&
git-rebase --merge master &&
......@@ -219,7 +219,7 @@ test_expect_success 'rebase --merge (U/U)' '
test_expect_success 'rebase --merge (U/L)' '
git config i18n.commitencoding UTF-8 &&
git config i18n.logoutputencoding ISO-8859-1 &&
. ../t3901-utf8.txt &&
. "$TEST_DIRECTORY"/t3901-utf8.txt &&
git reset --hard side &&
git-rebase --merge master &&
......@@ -231,7 +231,7 @@ test_expect_success 'rebase --merge (L/L)' '
# In this test we want ISO-8859-1 encoded commits as the result
git config i18n.commitencoding ISO-8859-1 &&
git config i18n.logoutputencoding ISO-8859-1 &&
. ../t3901-8859-1.txt &&
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
git reset --hard side &&
git-rebase --merge master &&
......@@ -244,7 +244,7 @@ test_expect_success 'rebase --merge (L/U)' '
# to get ISO-8859-1 results.
git config i18n.commitencoding ISO-8859-1 &&
git config i18n.logoutputencoding UTF-8 &&
. ../t3901-8859-1.txt &&
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
git reset --hard side &&
git-rebase --merge master &&
......
......@@ -7,7 +7,7 @@ test_description='Test built-in diff output engine.
'
. ./test-lib.sh
. ../diff-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh
echo >path0 'Line 1
Line 2
......
......@@ -7,7 +7,7 @@ test_description='Test rename detection in diff engine.
'
. ./test-lib.sh
. ../diff-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh
echo >path0 'Line 1
Line 2
......
......@@ -7,7 +7,7 @@ test_description='Test diff raw-output.
'
. ./test-lib.sh
. ../lib-read-tree-m-3way.sh
. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh
cat >.test-plain-OA <<\EOF
:000000 100644 0000000000000000000000000000000000000000 ccba72ad3888a3520b39efcf780b9ee64167535d A AA
......
......@@ -7,11 +7,11 @@ test_description='More rename detection
'
. ./test-lib.sh
. ../diff-lib.sh ;# test-lib chdir's into trash
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
test_expect_success \
'prepare reference tree' \
'cat ../../COPYING >COPYING &&
'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
echo frotz >rezrov &&
git update-index --add COPYING rezrov &&
tree=$(git write-tree) &&
......@@ -99,7 +99,7 @@ test_expect_success \
test_expect_success \
'prepare work tree once again' \
'cat ../../COPYING >COPYING &&
'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
git update-index --add --remove COPYING COPYING.1'
# tree has COPYING and rezrov. work tree has COPYING and COPYING.1,
......
......@@ -10,7 +10,7 @@ copy of symbolic links, but should not produce rename/copy followed
by an edit for them.
'
. ./test-lib.sh
. ../diff-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh
test_expect_success \
'prepare reference tree' \
......
......@@ -7,11 +7,11 @@ test_description='Same rename detection as t4003 but testing diff-raw.
'
. ./test-lib.sh
. ../diff-lib.sh ;# test-lib chdir's into trash
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
test_expect_success \
'prepare reference tree' \
'cat ../../COPYING >COPYING &&
'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
echo frotz >rezrov &&
git update-index --add COPYING rezrov &&
tree=$(git write-tree) &&
......@@ -71,7 +71,7 @@ test_expect_success \
test_expect_success \
'prepare work tree once again' \
'cat ../../COPYING >COPYING &&
'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
git update-index --add --remove COPYING COPYING.1'
git diff-index -C --find-copies-harder $tree >current
......
......@@ -7,12 +7,12 @@ test_description='Rename interaction with pathspec.
'
. ./test-lib.sh
. ../diff-lib.sh ;# test-lib chdir's into trash
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
test_expect_success \
'prepare reference tree' \
'mkdir path0 path1 &&
cp ../../COPYING path0/COPYING &&
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
git update-index --add path0/COPYING &&
tree=$(git write-tree) &&
echo $tree'
......
......@@ -22,12 +22,12 @@ four changes in total.
Further, with -B and -M together, these should turn into two renames.
'
. ./test-lib.sh
. ../diff-lib.sh ;# test-lib chdir's into trash
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
test_expect_success \
setup \
'cat ../../README >file0 &&
cat ../../COPYING >file1 &&
'cat "$TEST_DIRECTORY"/../README >file0 &&
cat "$TEST_DIRECTORY"/../COPYING >file1 &&
git update-index --add file0 file1 &&
tree=$(git write-tree) &&
echo "$tree"'
......
......@@ -7,11 +7,11 @@ test_description='Same rename detection as t4003 but testing diff-raw -z.
'
. ./test-lib.sh
. ../diff-lib.sh ;# test-lib chdir's into trash
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
test_expect_success \
'prepare reference tree' \
'cat ../../COPYING >COPYING &&
'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
echo frotz >rezrov &&
git update-index --add COPYING rezrov &&
tree=$(git write-tree) &&
......@@ -78,7 +78,7 @@ test_expect_success \
test_expect_success \
'prepare work tree once again' \
'cat ../../COPYING >COPYING &&
'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
git update-index --add --remove COPYING COPYING.1'
git diff-index -z -C --find-copies-harder $tree >current
......
......@@ -10,7 +10,7 @@ Prepare:
path1/file1
'
. ./test-lib.sh
. ../diff-lib.sh ;# test-lib chdir's into trash
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
test_expect_success \
setup \
......
......@@ -7,7 +7,7 @@ test_description='Test diff of symlinks.
'
. ./test-lib.sh
. ../diff-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh
cat > expected << EOF
diff --git a/frotz b/frotz
......
......@@ -12,7 +12,7 @@ test_expect_success 'prepare repository' \
'echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&
git update-index --add a b c d &&
echo git >a &&
cat ../test4012.png >b &&
cat "$TEST_DIRECTORY"/test4012.png >b &&
echo git >c &&
cat b b >d'
......
......@@ -99,7 +99,7 @@ do
test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'`
cnt=`expr $test_count + 1`
pfx=`printf "%04d" $cnt`
expect="../t4013/diff.$test"
expect="$TEST_DIRECTORY/t4013/diff.$test"
actual="$pfx-diff.$test"
test_expect_success "git $cmd" '
......
......@@ -7,7 +7,7 @@ test_description='Test special whitespace in diff engine.
'
. ./test-lib.sh
. ../diff-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh
# Ray Lehtiniemi's example
......
......@@ -104,7 +104,7 @@ echo NULZbetweenZwords | perl -pe 'y/Z/\000/' > file
test_expect_success 'force diff with "diff"' '
echo >.gitattributes "file diff" &&
git diff >actual &&
test_cmp ../t4020/diff.NUL actual
test_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual
'
test_done
......@@ -6,12 +6,12 @@ test_description='rewrite diff'
test_expect_success setup '
cat ../../COPYING >test &&
cat "$TEST_DIRECTORY"/../COPYING >test &&
git add test &&
tr \
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \
"nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \
<../../COPYING >test
<"$TEST_DIRECTORY"/../COPYING >test
'
......
......@@ -7,21 +7,21 @@ test_description='typechange rename detection'
test_expect_success setup '
rm -f foo bar &&
cat ../../COPYING >foo &&
cat "$TEST_DIRECTORY"/../COPYING >foo &&
ln -s linklink bar &&
git add foo bar &&
git commit -a -m Initial &&
git tag one &&
rm -f foo bar &&
cat ../../COPYING >bar &&
cat "$TEST_DIRECTORY"/../COPYING >bar &&
ln -s linklink foo &&
git add foo bar &&
git commit -a -m Second &&
git tag two &&
rm -f foo bar &&
cat ../../COPYING >foo &&
cat "$TEST_DIRECTORY"/../COPYING >foo &&
git add foo &&
git commit -a -m Third &&
git tag three &&
......@@ -35,15 +35,15 @@ test_expect_success setup '
# This is purely for sanity check
rm -f foo bar &&
cat ../../COPYING >foo &&
cat ../../Makefile >bar &&
cat "$TEST_DIRECTORY"/../COPYING >foo &&
cat "$TEST_DIRECTORY"/../Makefile >bar &&
git add foo bar &&
git commit -a -m Fifth &&
git tag five &&
rm -f foo bar &&
cat ../../Makefile >foo &&
cat ../../COPYING >bar &&
cat "$TEST_DIRECTORY"/../Makefile >foo &&
cat "$TEST_DIRECTORY"/../COPYING >bar &&
git add foo bar &&
git commit -a -m Sixth &&
git tag six
......
......@@ -3,7 +3,7 @@
test_description='difference in submodules'
. ./test-lib.sh
. ../diff-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh
_z40=0000000000000000000000000000000000000000
test_expect_success setup '
......
......@@ -17,13 +17,13 @@ do
test_expect_success "$title" '
git apply --stat --summary \
<"$TEST_DIRECTORY/t4100/t-apply-$num.patch" >current &&
test_cmp ../t4100/t-apply-$num.expect current
test_cmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
'
test_expect_success "$title with recount" '
sed -e "$UNC" <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" |
git apply --recount --stat --summary >current &&
test_cmp ../t4100/t-apply-$num.expect current
test_cmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
'
done <<\EOF
rename
......
......@@ -21,9 +21,10 @@ do
do
test $i -eq $j && continue
cat frotz.$i >frotz
test_expect_success \
"apply diff between $i and $j" \
"git apply <../t4101/diff.$i-$j && diff frotz.$j frotz"
test_expect_success "apply diff between $i and $j" '
git apply <"$TEST_DIRECTORY"/t4101/diff.$i-$j &&
test_cmp frotz.$j frotz
'
done
done
......
......@@ -8,27 +8,28 @@ test_description='git mailinfo and git mailsplit test'
. ./test-lib.sh
test_expect_success 'split sample box' \
'git mailsplit -o. ../t5100/sample.mbox >last &&
'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last &&
last=`cat last` &&
echo total is $last &&
test `cat last` = 11'
for mail in `echo 00*`
do
test_expect_success "mailinfo $mail" \
"git mailinfo -u msg$mail patch$mail <$mail >info$mail &&
test_expect_success "mailinfo $mail" '
git mailinfo -u msg$mail patch$mail <$mail >info$mail &&
echo msg &&
diff ../t5100/msg$mail msg$mail &&
test_cmp "$TEST_DIRECTORY"/t5100/msg$mail msg$mail &&
echo patch &&
diff ../t5100/patch$mail patch$mail &&
test_cmp "$TEST_DIRECTORY"/t5100/patch$mail patch$mail &&
echo info &&
diff ../t5100/info$mail info$mail"
test_cmp "$TEST_DIRECTORY"/t5100/info$mail info$mail
'
done
test_expect_success 'respect NULs' '
git mailsplit -d3 -o. ../t5100/nul-plain &&
cmp ../t5100/nul-plain 001 &&
git mailsplit -d3 -o. "$TEST_DIRECTORY"/t5100/nul-plain &&
test_cmp "$TEST_DIRECTORY"/t5100/nul-plain 001 &&
(cat 001 | git mailinfo msg patch) &&
test 4 = $(wc -l < patch)
......@@ -36,10 +37,10 @@ test_expect_success 'respect NULs' '
test_expect_success 'Preserve NULs out of MIME encoded message' '
git mailsplit -d5 -o. ../t5100/nul-b64.in &&
cmp ../t5100/nul-b64.in 00001 &&
git mailsplit -d5 -o. "$TEST_DIRECTORY"/t5100/nul-b64.in &&
test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.in 00001 &&
git mailinfo msg patch <00001 &&
cmp ../t5100/nul-b64.expect patch
test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.expect patch
'
......
......@@ -131,9 +131,9 @@ do
test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'`
cnt=`expr $test_count + 1`
pfx=`printf "%04d" $cnt`
expect_f="../../t5515/fetch.$test"
expect_f="$TEST_DIRECTORY/t5515/fetch.$test"
actual_f="$pfx-fetch.$test"
expect_r="../../t5515/refs.$test"
expect_r="$TEST_DIRECTORY/t5515/refs.$test"
actual_r="$pfx-refs.$test"
test_expect_success "$cmd" '
......
......@@ -19,7 +19,7 @@ then
exit
fi
. ../lib-httpd.sh
. "$TEST_DIRECTORY"/lib-httpd.sh
if ! start_httpd >&3 2>&4
then
......
......@@ -5,7 +5,7 @@
test_description='Tests git rev-list --bisect functionality'
. ./test-lib.sh
. ../t6000lib.sh # t6xxx specific functions
. "$TEST_DIRECTORY"/t6000lib.sh # t6xxx specific functions
# usage: test_bisection max-diff bisect-option head ^prune...
#
......
......@@ -6,7 +6,7 @@
test_description='Tests git rev-list --topo-order functionality'
. ./test-lib.sh
. ../t6000lib.sh # t6xxx specific functions
. "$TEST_DIRECTORY"/t6000lib.sh # t6xxx specific functions
list_duplicates()
{
......
......@@ -136,7 +136,7 @@ test_expect_success "expected conflict markers" "test_cmp expect out"
test_expect_success 'binary files cannot be merged' '
test_must_fail git merge-file -p \
orig.txt ../test4012.png new1.txt 2> merge.err &&
orig.txt "$TEST_DIRECTORY"/test4012.png new1.txt 2> merge.err &&
grep "Cannot merge binary files" merge.err
'
......
......@@ -6,7 +6,7 @@ test_description='ask merge-recursive to merge binary files'
test_expect_success setup '
cat ../test4012.png >m &&
cat "$TEST_DIRECTORY"/test4012.png >m &&
git add m &&
git ls-files -s | sed -e "s/ 0 / 1 /" >E1 &&
test_tick &&
......
......@@ -6,7 +6,7 @@
test_description='Test git rev-parse with different parent options'
. ./test-lib.sh
. ../t6000lib.sh # t6xxx specific functions
. "$TEST_DIRECTORY"/t6000lib.sh # t6xxx specific functions
date >path0
git update-index --add path0
......
......@@ -83,13 +83,13 @@ test_expect_success 'merge-msg test #1' '
'
cat >expected <<EOF
Merge branch 'left' of ../$test
Merge branch 'left' of $TEST_DIRECTORY/$test
EOF
test_expect_success 'merge-msg test #2' '
git checkout master &&
git fetch ../"$test" left &&
git fetch "$TEST_DIRECTORY/$test" left &&
git fmt-merge-msg <.git/FETCH_HEAD >actual &&
test_cmp expected actual
......
......@@ -6,7 +6,7 @@ test_description='git mv in subdirs'
test_expect_success \
'prepare reference tree' \
'mkdir path0 path1 &&
cp ../../COPYING path0/COPYING &&
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
git add path0/COPYING &&
git-commit -m add -a'
......@@ -40,7 +40,7 @@ test_expect_success \
test_expect_success \
'adding another file' \
'cp ../../README path0/README &&
'cp "$TEST_DIRECTORY"/../README path0/README &&
git add path0/README &&
git-commit -m add2 -a'
......
......@@ -625,7 +625,7 @@ esac
# Name and email: C O Mitter <committer@example.com>
# No password given, to enable non-interactive operation.
cp -R ../t7004 ./gpghome
cp -R "$TEST_DIRECTORY"/t7004 ./gpghome
chmod 0700 gpghome
GNUPGHOME="$(pwd)/gpghome"
export GNUPGHOME
......
......@@ -9,7 +9,7 @@ test_description='git-reset should cull empty subdirs'
test_expect_success \
'creating initial files' \
'mkdir path0 &&
cp ../../COPYING path0/COPYING &&
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
git add path0/COPYING &&
git-commit -m add -a'
......@@ -17,10 +17,10 @@ test_expect_success \
'creating second files' \
'mkdir path1 &&
mkdir path1/path2 &&
cp ../../COPYING path1/path2/COPYING &&
cp ../../COPYING path1/COPYING &&
cp ../../COPYING COPYING &&
cp ../../COPYING path0/COPYING-TOO &&
cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
cp "$TEST_DIRECTORY"/../COPYING COPYING &&
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING-TOO &&
git add path1/path2/COPYING &&
git add path1/COPYING &&
git add COPYING &&
......
......@@ -46,15 +46,24 @@ test_expect_success 'unedited template with comments should not commit' '
'
test_expect_success 'a Signed-off-by line by itself should not commit' '
! GIT_EDITOR=../t7500/add-signed-off git commit --template "$TEMPLATE"
(
test_set_editor "$TEST_DIRECTORY"/t7500/add-signed-off &&
test_must_fail git commit --template "$TEMPLATE"
)
'
test_expect_success 'adding comments to a template should not commit' '
! GIT_EDITOR=../t7500/add-comments git commit --template "$TEMPLATE"
(
test_set_editor "$TEST_DIRECTORY"/t7500/add-comments &&
test_must_fail git commit --template "$TEMPLATE"
)
'
test_expect_success 'adding real content to a template should commit' '
GIT_EDITOR=../t7500/add-content git commit --template "$TEMPLATE" &&
(
test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
git commit --template "$TEMPLATE"
) &&
commit_msg_is "template linecommit message"
'
......@@ -62,7 +71,10 @@ test_expect_success '-t option should be short for --template' '
echo "short template" > "$TEMPLATE" &&
echo "new content" >> foo &&
git add foo &&
GIT_EDITOR=../t7500/add-content git commit -t "$TEMPLATE" &&
(
test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
git commit -t "$TEMPLATE"
) &&
commit_msg_is "short templatecommit message"
'
......@@ -71,7 +83,10 @@ test_expect_success 'config-specified template should commit' '
git config commit.template "$TEMPLATE" &&
echo "more content" >> foo &&
git add foo &&
GIT_EDITOR=../t7500/add-content git commit &&
(
test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
git commit
) &&
git config --unset commit.template &&
commit_msg_is "new templatecommit message"
'
......@@ -79,7 +94,7 @@ test_expect_success 'config-specified template should commit' '
test_expect_success 'explicit commit message should override template' '
echo "still more content" >> foo &&
git add foo &&
GIT_EDITOR=../t7500/add-content git commit --template "$TEMPLATE" \
GIT_EDITOR="$TEST_DIRECTORY"/t7500/add-content git commit --template "$TEMPLATE" \
-m "command line msg" &&
commit_msg_is "command line msg"
'
......@@ -88,8 +103,10 @@ test_expect_success 'commit message from file should override template' '
echo "content galore" >> foo &&
git add foo &&
echo "standard input msg" |
GIT_EDITOR=../t7500/add-content git commit \
--template "$TEMPLATE" --file - &&
(
test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
git commit --template "$TEMPLATE" --file -
) &&
commit_msg_is "standard input msg"
'
......@@ -132,10 +149,12 @@ EOF
test_expect_success '--signoff' '
echo "yet another content *narf*" >> foo &&
echo "zort" |
GIT_EDITOR=../t7500/add-content git commit -s -F - foo &&
echo "zort" | (
test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
git commit -s -F - foo
) &&
git cat-file commit HEAD | sed "1,/^$/d" > output &&
diff expect output
test_cmp expect output
'
test_expect_success 'commit message from file (1)' '
......
......@@ -4,7 +4,7 @@ test_description='git annotate'
. ./test-lib.sh
PROG='git annotate'
. ../annotate-tests.sh
. "$TEST_DIRECTORY"/annotate-tests.sh
test_expect_success \
'Annotating an old revision works' \
......
......@@ -4,6 +4,6 @@ test_description='git blame'
. ./test-lib.sh
PROG='git blame -c'
. ../annotate-tests.sh
. "$TEST_DIRECTORY"/annotate-tests.sh
test_done
......@@ -8,7 +8,7 @@ test_description='git-svn useSvmProps test'
. ./lib-git-svn.sh
test_expect_success 'load svm repo' '
svnadmin load -q "$rawsvnrepo" < ../t9110/svm.dump &&
svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9110/svm.dump &&
git-svn init --minimize-url -R arr -i bar "$svnrepo"/mirror/arr &&
git-svn init --minimize-url -R argh -i dir "$svnrepo"/mirror/argh &&
git-svn init --minimize-url -R argh -i e \
......
......@@ -8,7 +8,7 @@ test_description='git-svn useSvnsyncProps test'
. ./lib-git-svn.sh
test_expect_success 'load svnsync repo' '
svnadmin load -q "$rawsvnrepo" < ../t9111/svnsync.dump &&
svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9111/svnsync.dump &&
git-svn init --minimize-url -R arr -i bar "$svnrepo"/bar &&
git-svn init --minimize-url -R argh -i dir "$svnrepo"/dir &&
git-svn init --minimize-url -R argh -i e "$svnrepo"/dir/a/b/c/d/e &&
......
......@@ -8,7 +8,7 @@ test_description='git-svn dcommit can commit renames of files with ugly names'
. ./lib-git-svn.sh
test_expect_success 'load repository with strange names' '
svnadmin load -q "$rawsvnrepo" < ../t9115/funky-names.dump &&
svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9115/funky-names.dump &&
start_httpd gtk+
'
......
......@@ -8,7 +8,7 @@ test_description='git-svn can fetch renamed directories'
. ./lib-git-svn.sh
test_expect_success 'load repository with renamed directory' '
svnadmin load -q "$rawsvnrepo" < ../t9121/renamed-dir.dump
svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9121/renamed-dir.dump
'
test_expect_success 'init and fetch repository' '
......
......@@ -45,8 +45,8 @@ test_expect_success \
'mkdir A B C D E F &&
echo hello1 >A/newfile1.txt &&
echo hello2 >B/newfile2.txt &&
cp ../test9200a.png C/newfile3.png &&
cp ../test9200a.png D/newfile4.png &&
cp "$TEST_DIRECTORY"/test9200a.png C/newfile3.png &&
cp "$TEST_DIRECTORY"/test9200a.png D/newfile4.png &&
git add A/newfile1.txt &&
git add B/newfile2.txt &&
git add C/newfile3.png &&
......@@ -71,8 +71,8 @@ test_expect_success \
rm -f B/newfile2.txt &&
rm -f C/newfile3.png &&
echo Hello5 >E/newfile5.txt &&
cp ../test9200b.png D/newfile4.png &&
cp ../test9200a.png F/newfile6.png &&
cp "$TEST_DIRECTORY"/test9200b.png D/newfile4.png &&
cp "$TEST_DIRECTORY"/test9200a.png F/newfile6.png &&
git add E/newfile5.txt &&
git add F/newfile6.png &&
git commit -a -m "Test: Remove, add and update" &&
......@@ -160,7 +160,7 @@ test_expect_success \
'mkdir "G g" &&
echo ok then >"G g/with spaces.txt" &&
git add "G g/with spaces.txt" && \
cp ../test9200a.png "G g/with spaces.png" && \
cp "$TEST_DIRECTORY"/test9200a.png "G g/with spaces.png" && \
git add "G g/with spaces.png" &&
git commit -a -m "With spaces" &&
id=$(git rev-list --max-count=1 HEAD) &&
......@@ -172,7 +172,7 @@ test_expect_success \
test_expect_success \
'Update file with spaces in file name' \
'echo Ok then >>"G g/with spaces.txt" &&
cat ../test9200a.png >>"G g/with spaces.png" && \
cat "$TEST_DIRECTORY"/test9200a.png >>"G g/with spaces.png" && \
git add "G g/with spaces.png" &&
git commit -a -m "Update with spaces" &&
id=$(git rev-list --max-count=1 HEAD) &&
......@@ -197,7 +197,7 @@ test_expect_success \
'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/å/ä/ö &&
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 &&
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 &&
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 &&
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 &&
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 &&
git commit -a -m "Går det så går det" && \
id=$(git rev-list --max-count=1 HEAD) &&
......
......@@ -5,7 +5,7 @@
test_description='test git-fast-import utility'
. ./test-lib.sh
. ../diff-lib.sh ;# test-lib chdir's into trash
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
file2_data='file2
second line of EOF'
......
......@@ -67,7 +67,7 @@ test_expect_success 'iso-8859-1' '
git config i18n.commitencoding ISO-8859-1 &&
# use author and committer name in ISO-8859-1 to match it.
. ../t3901-8859-1.txt &&
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
test_tick &&
echo rosten >file &&
git commit -s -m den file &&
......
......@@ -25,9 +25,9 @@ our \$site_name = "[localhost]";
our \$site_header = "";
our \$site_footer = "";
our \$home_text = "indextext.html";
our @stylesheets = ("file:///$safe_pwd/../../gitweb/gitweb.css");
our \$logo = "file:///$safe_pwd/../../gitweb/git-logo.png";
our \$favicon = "file:///$safe_pwd/../../gitweb/git-favicon.png";
our @stylesheets = ("file:///$TEST_DIRECTORY/../gitweb/gitweb.css");
our \$logo = "file:///$TEST_DIRECTORY/../gitweb/git-logo.png";
our \$favicon = "file:///$TEST_DIRECTORY/../gitweb/git-favicon.png";
our \$projects_list = "";
our \$export_ok = "";
our \$strict_export = "";
......@@ -54,7 +54,7 @@ gitweb_run () {
# written to web server logs, so we are not interested in that:
# we are interested only in properly formatted errors/warnings
rm -f gitweb.log &&
perl -- "$(pwd)/../../gitweb/gitweb.perl" \
perl -- "$TEST_DIRECTORY/../gitweb/gitweb.perl" \
>/dev/null 2>gitweb.log &&
if grep -q -s "^[[]" gitweb.log >/dev/null; then false; else true; fi
......@@ -525,20 +525,20 @@ test_debug 'cat gitweb.log'
test_expect_success \
'encode(commit): utf8' \
'. ../t3901-utf8.txt &&
'. "$TEST_DIRECTORY"/t3901-utf8.txt &&
echo "UTF-8" >> file &&
git add file &&
git commit -F ../t3900/1-UTF-8.txt &&
git commit -F "$TEST_DIRECTORY"/t3900/1-UTF-8.txt &&
gitweb_run "p=.git;a=commit"'
test_debug 'cat gitweb.log'
test_expect_success \
'encode(commit): iso-8859-1' \
'. ../t3901-8859-1.txt &&
'. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
echo "ISO-8859-1" >> file &&
git add file &&
git config i18n.commitencoding ISO-8859-1 &&
git commit -F ../t3900/ISO-8859-1.txt &&
git commit -F "$TEST_DIRECTORY"/t3900/ISO-8859-1.txt &&
git config --unset i18n.commitencoding &&
gitweb_run "p=.git;a=commit"'
test_debug 'cat gitweb.log'
......
......@@ -39,6 +39,6 @@ test_expect_success \
test_external_without_stderr \
'Perl API' \
perl ../t9700/test.pl
perl "$TEST_DIRECTORY"/t9700/test.pl
test_done
......@@ -14,10 +14,7 @@
BEGIN { use_ok('Git') }
# set up
our $repo_dir = "trash directory";
our $abs_repo_dir = Cwd->cwd;
die "this must be run by calling the t/t97* shell script(s)\n"
if basename(Cwd->cwd) ne $repo_dir;
ok(our $r = Git->repository(Directory => "."), "open repository");
# config
......
......@@ -406,7 +406,7 @@ test_create_repo () {
error "bug in the test script: not 1 parameter to test-create-repo"
owd=`pwd`
repo="$1"
mkdir "$repo"
mkdir -p "$repo"
cd "$repo" || error "Cannot setup test environment"
"$GIT_EXEC_PATH/git" init "--template=$GIT_EXEC_PATH/templates/blt/" >&3 2>&4 ||
error "cannot run git init -- have you built things yet?"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册