mirror of
https://github.com/git/git.git
synced 2026-04-01 20:40:08 +02:00
Merge branch 'for-junio' of ssh://repo.or.cz/srv/git/git/mingw/j6t
This resets many changes in test scripts so that the scripts are again identical to upstream.
This commit is contained in:
@@ -57,6 +57,21 @@ test_expect_failure 'pretend we have a known breakage' '
|
||||
test_expect_failure 'pretend we have fixed a known breakage' '
|
||||
:
|
||||
'
|
||||
test_set_prereq HAVEIT
|
||||
haveit=no
|
||||
test_expect_success HAVEIT 'test runs if prerequisite is satisfied' '
|
||||
test_have_prereq HAVEIT &&
|
||||
haveit=yes
|
||||
'
|
||||
donthaveit=yes
|
||||
test_expect_success DONTHAVEIT 'unmet prerequisite causes test to be skipped' '
|
||||
donthaveit=no
|
||||
'
|
||||
if test $haveit$donthaveit != yesyes
|
||||
then
|
||||
say "bug in test framework: prerequisite tags do not work reliably"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
################################################################
|
||||
# Basics of the basics
|
||||
@@ -108,7 +123,7 @@ for p in $paths
|
||||
do
|
||||
echo "hello $p" >$p
|
||||
done
|
||||
if test -z "$no_symlinks"
|
||||
if test_have_prereq SYMLINKS
|
||||
then
|
||||
for p in $paths
|
||||
do
|
||||
@@ -144,7 +159,6 @@ $expectfilter >expected <<\EOF
|
||||
100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0 path3/subp3/file3
|
||||
120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0 path3/subp3/file3sym
|
||||
EOF
|
||||
|
||||
test_expect_success \
|
||||
'validate git ls-files output for a known tree.' \
|
||||
'test_cmp expected current'
|
||||
@@ -165,8 +179,7 @@ cat >expected <<\EOF
|
||||
040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2
|
||||
040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3
|
||||
EOF
|
||||
test -z "$no_symlinks" &&
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'git ls-tree output for a known tree.' \
|
||||
'test_cmp expected current'
|
||||
|
||||
@@ -206,8 +219,7 @@ cat >expected <<\EOF
|
||||
100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3
|
||||
120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym
|
||||
EOF
|
||||
test -z "$no_symlinks" &&
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'git ls-tree -r output for a known tree.' \
|
||||
'test_cmp expected current'
|
||||
|
||||
@@ -315,8 +327,7 @@ test_expect_success 'update-index D/F conflict' '
|
||||
test $numpath0 = 1
|
||||
'
|
||||
|
||||
test -z "$no_symlinks" &&
|
||||
test_expect_success 'absolute path works as expected' '
|
||||
test_expect_success SYMLINKS 'absolute path works as expected' '
|
||||
mkdir first &&
|
||||
ln -s ../.git first/.git &&
|
||||
mkdir second &&
|
||||
|
||||
@@ -4,13 +4,6 @@ test_description='detect unwritable repository and fail correctly'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
case "$(uname -s)" in
|
||||
*MINGW*)
|
||||
say "chmod a-w .git/objects does not make directory unwritable - skipping tests"
|
||||
test_done
|
||||
;;
|
||||
esac
|
||||
|
||||
test_expect_success setup '
|
||||
|
||||
>file &&
|
||||
@@ -22,7 +15,7 @@ test_expect_success setup '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'write-tree should notice unwritable repository' '
|
||||
test_expect_success POSIXPERM 'write-tree should notice unwritable repository' '
|
||||
|
||||
(
|
||||
chmod a-w .git/objects .git/objects/?? &&
|
||||
@@ -34,7 +27,7 @@ test_expect_success 'write-tree should notice unwritable repository' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'commit should notice unwritable repository' '
|
||||
test_expect_success POSIXPERM 'commit should notice unwritable repository' '
|
||||
|
||||
(
|
||||
chmod a-w .git/objects .git/objects/?? &&
|
||||
@@ -46,7 +39,7 @@ test_expect_success 'commit should notice unwritable repository' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'update-index should notice unwritable repository' '
|
||||
test_expect_success POSIXPERM 'update-index should notice unwritable repository' '
|
||||
|
||||
(
|
||||
echo 6O >file &&
|
||||
@@ -59,7 +52,7 @@ test_expect_success 'update-index should notice unwritable repository' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'add should notice unwritable repository' '
|
||||
test_expect_success POSIXPERM 'add should notice unwritable repository' '
|
||||
|
||||
(
|
||||
echo b >file &&
|
||||
|
||||
@@ -29,11 +29,11 @@ test_expect_success 'tar archive' '
|
||||
"$UNZIP" -v >/dev/null 2>&1
|
||||
if [ $? -eq 127 ]; then
|
||||
say "Skipping ZIP test, because unzip was not found"
|
||||
test_done
|
||||
exit
|
||||
else
|
||||
test_set_prereq UNZIP
|
||||
fi
|
||||
|
||||
test_expect_success 'zip archive' '
|
||||
test_expect_success UNZIP 'zip archive' '
|
||||
|
||||
git archive --format=zip HEAD >test.zip &&
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ aumlcdiar=`printf '\x61\xcc\x88'`
|
||||
|
||||
case_insensitive=
|
||||
unibad=
|
||||
test_expect_success 'see if we expect ' '
|
||||
no_symlinks=
|
||||
test_expect_success 'see what we expect' '
|
||||
|
||||
test_case=test_expect_success
|
||||
test_unicode=test_expect_success
|
||||
@@ -31,13 +32,21 @@ test_expect_success 'see if we expect ' '
|
||||
;;
|
||||
*) ;;
|
||||
esac &&
|
||||
rm -fr junk
|
||||
rm -fr junk &&
|
||||
{
|
||||
ln -s x y 2> /dev/null &&
|
||||
test -h y 2> /dev/null ||
|
||||
no_symlinks=1
|
||||
rm -f y
|
||||
}
|
||||
'
|
||||
|
||||
test "$case_insensitive" &&
|
||||
say "will test on a case insensitive filesystem"
|
||||
test "$unibad" &&
|
||||
say "will test on a unicode corrupting filesystem"
|
||||
test "$no_symlinks" &&
|
||||
say "will test on a filesystem lacking symbolic links"
|
||||
|
||||
if test "$case_insensitive"
|
||||
then
|
||||
@@ -53,6 +62,21 @@ test_expect_success "detection of case insensitive filesystem during repo init"
|
||||
'
|
||||
fi
|
||||
|
||||
if test "$no_symlinks"
|
||||
then
|
||||
test_expect_success "detection of filesystem w/o symlink support during repo init" '
|
||||
|
||||
v=$(git config --bool core.symlinks) &&
|
||||
test "$v" = false
|
||||
'
|
||||
else
|
||||
test_expect_success "detection of filesystem w/o symlink support during repo init" '
|
||||
|
||||
test_must_fail git config --bool core.symlinks ||
|
||||
test "$(git config --bool core.symlinks)" = true
|
||||
'
|
||||
fi
|
||||
|
||||
test_expect_success "setup case tests" '
|
||||
|
||||
git config core.ignorecase true &&
|
||||
|
||||
@@ -4,12 +4,7 @@ test_description='update-index and add refuse to add beyond symlinks'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
if test "$no_symlinks"; then
|
||||
say "symbolic links not supported - skipping tests"
|
||||
test_done
|
||||
fi
|
||||
|
||||
test_expect_success setup '
|
||||
test_expect_success SYMLINKS setup '
|
||||
>a &&
|
||||
mkdir b &&
|
||||
ln -s b c &&
|
||||
@@ -17,12 +12,12 @@ test_expect_success setup '
|
||||
git update-index --add a b/d
|
||||
'
|
||||
|
||||
test_expect_success 'update-index --add beyond symlinks' '
|
||||
test_expect_success SYMLINKS 'update-index --add beyond symlinks' '
|
||||
test_must_fail git update-index --add c/d &&
|
||||
! ( git ls-files | grep c/d )
|
||||
'
|
||||
|
||||
test_expect_success 'add beyond symlinks' '
|
||||
test_expect_success SYMLINKS 'add beyond symlinks' '
|
||||
test_must_fail git add c/d &&
|
||||
! ( git ls-files | grep c/d )
|
||||
'
|
||||
|
||||
@@ -8,7 +8,7 @@ test_description='Test various path utilities'
|
||||
. ./test-lib.sh
|
||||
|
||||
norm_path() {
|
||||
test_expect_success "normalize path: $1 => $2" \
|
||||
test_expect_success $3 "normalize path: $1 => $2" \
|
||||
"test \"\$(test-path-utils normalize_path_copy '$1')\" = '$2'"
|
||||
}
|
||||
|
||||
@@ -34,6 +34,16 @@ ancestor() {
|
||||
test \"\$actual\" = '$expected'"
|
||||
}
|
||||
|
||||
# Absolute path tests must be skipped on Windows because due to path mangling
|
||||
# the test program never sees a POSIX-style absolute path
|
||||
case $(uname -s) in
|
||||
*MINGW*)
|
||||
;;
|
||||
*)
|
||||
test_set_prereq POSIX
|
||||
;;
|
||||
esac
|
||||
|
||||
norm_path "" ""
|
||||
norm_path . ""
|
||||
norm_path ./ ""
|
||||
@@ -58,13 +68,6 @@ norm_path d1/s1//../s2/../../d2 d2
|
||||
norm_path d1/.../d2 d1/.../d2
|
||||
norm_path d1/..././../d2 d1/d2
|
||||
|
||||
# Absolute path tests must be skipped on Windows because due to path mangling
|
||||
# the test program never sees a POSIX-style absolute path
|
||||
case $(uname -s) in
|
||||
*MINGW*)
|
||||
;;
|
||||
*)
|
||||
|
||||
norm_path / / POSIX
|
||||
norm_path // / POSIX
|
||||
norm_path /// / POSIX
|
||||
@@ -90,9 +93,6 @@ norm_path /d1/s1//../s2/../../d2 /d2 POSIX
|
||||
norm_path /d1/.../d2 /d1/.../d2 POSIX
|
||||
norm_path /d1/..././../d2 /d1/d2 POSIX
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
ancestor / "" -1
|
||||
ancestor / / -1
|
||||
ancestor /foo "" -1
|
||||
|
||||
@@ -157,8 +157,7 @@ test_expect_success '3-way not overwriting local changes (their side)' '
|
||||
|
||||
'
|
||||
|
||||
test "$no_symlinks" || {
|
||||
test_expect_success 'funny symlink in work tree' '
|
||||
test_expect_success SYMLINKS 'funny symlink in work tree' '
|
||||
|
||||
git reset --hard &&
|
||||
git checkout -b sym-b side-b &&
|
||||
@@ -178,7 +177,7 @@ test_expect_success 'funny symlink in work tree' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'funny symlink in work tree, un-unlink-able' '
|
||||
test_expect_success SYMLINKS 'funny symlink in work tree, un-unlink-able' '
|
||||
|
||||
rm -fr a b &&
|
||||
git reset --hard &&
|
||||
@@ -190,9 +189,8 @@ test_expect_success 'funny symlink in work tree, un-unlink-able' '
|
||||
'
|
||||
|
||||
# clean-up from the above test
|
||||
chmod a+w a
|
||||
chmod a+w a 2>/dev/null
|
||||
rm -fr a b
|
||||
} # $no_symlinks
|
||||
|
||||
test_expect_success 'D/F setup' '
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ test_expect_success 'no file/rev ambiguity check inside a bare repo' '
|
||||
cd foo.git && git show -s HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'detection should not be fooled by a symlink' '
|
||||
test_expect_success SYMLINKS 'detection should not be fooled by a symlink' '
|
||||
cd "$HERE" &&
|
||||
rm -fr foo.git &&
|
||||
git clone -s .git another &&
|
||||
|
||||
@@ -733,8 +733,7 @@ echo >>result
|
||||
|
||||
test_expect_success '--null --get-regexp' 'cmp result expect'
|
||||
|
||||
test "$no_symlinks" ||
|
||||
test_expect_success 'symlinked configuration' '
|
||||
test_expect_success SYMLINKS 'symlinked configuration' '
|
||||
|
||||
ln -s notyet myconfig &&
|
||||
GIT_CONFIG=myconfig git config test.frotz nitfol &&
|
||||
|
||||
@@ -26,7 +26,7 @@ modebits () {
|
||||
|
||||
for u in 002 022
|
||||
do
|
||||
test_expect_success "shared=1 does not clear bits preset by umask $u" '
|
||||
test_expect_success POSIXPERM "shared=1 does not clear bits preset by umask $u" '
|
||||
mkdir sub && (
|
||||
cd sub &&
|
||||
umask $u &&
|
||||
@@ -54,7 +54,7 @@ test_expect_success 'shared=all' '
|
||||
test 2 = $(git config core.sharedrepository)
|
||||
'
|
||||
|
||||
test_expect_success 'update-server-info honors core.sharedRepository' '
|
||||
test_expect_success POSIXPERM 'update-server-info honors core.sharedRepository' '
|
||||
: > a1 &&
|
||||
git add a1 &&
|
||||
test_tick &&
|
||||
@@ -85,7 +85,7 @@ do
|
||||
git config core.sharedrepository "$u" &&
|
||||
umask 0277 &&
|
||||
|
||||
test_expect_success "shared = $u ($y) ro" '
|
||||
test_expect_success POSIXPERM "shared = $u ($y) ro" '
|
||||
|
||||
rm -f .git/info/refs &&
|
||||
git update-server-info &&
|
||||
@@ -97,7 +97,7 @@ do
|
||||
'
|
||||
|
||||
umask 077 &&
|
||||
test_expect_success "shared = $u ($x) rw" '
|
||||
test_expect_success POSIXPERM "shared = $u ($x) rw" '
|
||||
|
||||
rm -f .git/info/refs &&
|
||||
git update-server-info &&
|
||||
@@ -111,7 +111,7 @@ do
|
||||
|
||||
done
|
||||
|
||||
test_expect_success 'git reflog expire honors core.sharedRepository' '
|
||||
test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' '
|
||||
git config core.sharedRepository group &&
|
||||
git reflog expire --all &&
|
||||
actual="$(ls -l .git/logs/refs/heads/master)" &&
|
||||
|
||||
@@ -59,12 +59,10 @@ test_expect_success \
|
||||
'git read-tree -m $tree1 && git checkout-index -f -a'
|
||||
test_debug 'show_files $tree1'
|
||||
|
||||
test "$no_symlinks" || {
|
||||
ln -s path0 path1
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'git update-index --add a symlink.' \
|
||||
'git update-index --add path1'
|
||||
}
|
||||
'ln -s path0 path1 &&
|
||||
git update-index --add path1'
|
||||
test_expect_success \
|
||||
'writing tree out with git write-tree' \
|
||||
'tree3=$(git write-tree)'
|
||||
|
||||
@@ -19,8 +19,7 @@ test_expect_success \
|
||||
echo rezrov >path1/file1 &&
|
||||
git update-index --add path0 path1/file1'
|
||||
|
||||
test "$no_symlinks" || {
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'have symlink in place where dir is expected.' \
|
||||
'rm -fr path0 path1 &&
|
||||
mkdir path2 &&
|
||||
@@ -28,7 +27,6 @@ test_expect_success \
|
||||
git checkout-index -f -a &&
|
||||
test ! -h path1 && test -d path1 &&
|
||||
test -f path1/file1 && test ! -f path2/file1'
|
||||
}
|
||||
|
||||
test_expect_success \
|
||||
'use --prefix=path2/' \
|
||||
@@ -60,9 +58,8 @@ test_expect_success \
|
||||
test ! -f path0 &&
|
||||
test ! -f path1/file1'
|
||||
|
||||
test "$no_symlinks" || {
|
||||
# Linus fix #1
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'use --prefix=tmp/orary/ where tmp is a symlink' \
|
||||
'rm -fr path0 path1 path2 tmp* &&
|
||||
mkdir tmp1 tmp1/orary &&
|
||||
@@ -74,7 +71,7 @@ test_expect_success \
|
||||
test -h tmp'
|
||||
|
||||
# Linus fix #2
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'use --prefix=tmp/orary- where tmp is a symlink' \
|
||||
'rm -fr path0 path1 path2 tmp* &&
|
||||
mkdir tmp1 &&
|
||||
@@ -85,7 +82,7 @@ test_expect_success \
|
||||
test -h tmp'
|
||||
|
||||
# Linus fix #3
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'use --prefix=tmp- where tmp-path1 is a symlink' \
|
||||
'rm -fr path0 path1 path2 tmp* &&
|
||||
mkdir tmp1 &&
|
||||
@@ -95,6 +92,5 @@ test_expect_success \
|
||||
test ! -h tmp-path1 &&
|
||||
test -d tmp-path1 &&
|
||||
test -f tmp-path1/file1'
|
||||
}
|
||||
|
||||
test_done
|
||||
|
||||
@@ -194,8 +194,7 @@ test_expect_success \
|
||||
test $(cat ../$s1) = tree1asubdir/path5)
|
||||
)'
|
||||
|
||||
test "$no_symlinks" || {
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'checkout --temp symlink' '
|
||||
rm -f path* .merge_* out .git/index &&
|
||||
ln -s b a &&
|
||||
@@ -209,6 +208,5 @@ test $(cut "-d " -f2 out) = a &&
|
||||
p=$(cut "-d " -f1 out) &&
|
||||
test -f $p &&
|
||||
test $(cat $p) = b'
|
||||
}
|
||||
|
||||
test_done
|
||||
|
||||
@@ -6,11 +6,10 @@ test_description='git checkout to switch between branches with symlink<->dir'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
if test "$no_symlinks"
|
||||
if ! test_have_prereq SYMLINKS
|
||||
then
|
||||
say 'Symbolic links not supported, skipping tests.'
|
||||
test_done
|
||||
exit
|
||||
say "symbolic links not supported - skipping tests"
|
||||
test_done
|
||||
fi
|
||||
|
||||
test_expect_success setup '
|
||||
|
||||
@@ -26,10 +26,14 @@ All of the attempts should fail.
|
||||
|
||||
mkdir path2 path3
|
||||
date >path0
|
||||
ln -s xyzzy path1
|
||||
if test_have_prereq SYMLINKS
|
||||
then
|
||||
ln -s xyzzy path1
|
||||
else
|
||||
date > path1
|
||||
fi
|
||||
date >path2/file2
|
||||
date >path3/file3
|
||||
test "$no_symlinks" && date > path1
|
||||
|
||||
test_expect_success \
|
||||
'git update-index --add to add various paths.' \
|
||||
@@ -39,10 +43,14 @@ rm -fr path?
|
||||
|
||||
mkdir path0 path1
|
||||
date >path2
|
||||
ln -s frotz path3
|
||||
if test_have_prereq SYMLINKS
|
||||
then
|
||||
ln -s frotz path3
|
||||
else
|
||||
date > path3
|
||||
fi
|
||||
date >path0/file0
|
||||
date >path1/file1
|
||||
test "$no_symlinks" && date > path3
|
||||
|
||||
for p in path0/file0 path1/file1 path2 path3
|
||||
do
|
||||
|
||||
@@ -80,7 +80,7 @@ test_expect_success 'change gets noticed' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'replace a file with a symlink' '
|
||||
test_expect_success SYMLINKS 'replace a file with a symlink' '
|
||||
|
||||
rm foo &&
|
||||
ln -s top foo &&
|
||||
|
||||
@@ -4,15 +4,6 @@ test_description='more git add -u'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
symlink_change=T
|
||||
if test "$no_symlinks"
|
||||
then
|
||||
ln () {
|
||||
echo -n "$2" > "$3"
|
||||
}
|
||||
symlink_change=M
|
||||
fi
|
||||
|
||||
_z40=0000000000000000000000000000000000000000
|
||||
|
||||
test_expect_success setup '
|
||||
@@ -20,7 +11,13 @@ test_expect_success setup '
|
||||
_empty=$(git hash-object --stdin <xyzzy) &&
|
||||
>yomin &&
|
||||
>caskly &&
|
||||
ln -s frotz nitfol &&
|
||||
if test_have_prereq SYMLINKS; then
|
||||
ln -s frotz nitfol &&
|
||||
T_letter=T
|
||||
else
|
||||
printf %s frotz > nitfol &&
|
||||
T_letter=M
|
||||
fi &&
|
||||
mkdir rezrov &&
|
||||
>rezrov/bozbar &&
|
||||
git add caskly xyzzy yomin nitfol rezrov/bozbar &&
|
||||
@@ -38,7 +35,11 @@ test_expect_success modify '
|
||||
>nitfol &&
|
||||
# rezrov/bozbar disappears
|
||||
rm -fr rezrov &&
|
||||
ln -s xyzzy rezrov &&
|
||||
if test_have_prereq SYMLINKS; then
|
||||
ln -s xyzzy rezrov
|
||||
else
|
||||
printf %s xyzzy > rezrov
|
||||
fi &&
|
||||
# xyzzy disappears (not a submodule)
|
||||
mkdir xyzzy &&
|
||||
echo gnusto >xyzzy/bozbar &&
|
||||
@@ -80,7 +81,7 @@ test_expect_success modify '
|
||||
s/blob/000000/
|
||||
}
|
||||
/ nitfol/{
|
||||
s/ nitfol/ $_z40 $symlink_change&/
|
||||
s/ nitfol/ $_z40 $T_letter&/
|
||||
s/blob/100644/
|
||||
}
|
||||
/ rezrov.bozbar/{
|
||||
|
||||
@@ -5,7 +5,7 @@ test_description='cd_to_toplevel'
|
||||
. ./test-lib.sh
|
||||
|
||||
test_cd_to_toplevel () {
|
||||
test_expect_success "$2" '
|
||||
test_expect_success $3 "$2" '
|
||||
(
|
||||
cd '"'$1'"' &&
|
||||
. git-sh-setup &&
|
||||
@@ -24,20 +24,14 @@ test_cd_to_toplevel repo 'at physical root'
|
||||
|
||||
test_cd_to_toplevel repo/sub/dir 'at physical subdir'
|
||||
|
||||
if test "$no_symlinks"; then
|
||||
say "symbolic links not supported - skipping tests"
|
||||
else
|
||||
ln -s repo symrepo 2>/dev/null
|
||||
test_cd_to_toplevel symrepo 'at symbolic root' SYMLINKS
|
||||
|
||||
ln -s repo symrepo
|
||||
test_cd_to_toplevel symrepo 'at symbolic root'
|
||||
|
||||
ln -s repo/sub/dir subdir-link
|
||||
test_cd_to_toplevel subdir-link 'at symbolic subdir'
|
||||
ln -s repo/sub/dir subdir-link 2>/dev/null
|
||||
test_cd_to_toplevel subdir-link 'at symbolic subdir' SYMLINKS
|
||||
|
||||
cd repo
|
||||
ln -s sub/dir internal-link
|
||||
test_cd_to_toplevel internal-link 'at internal symbolic subdir'
|
||||
|
||||
fi # $no_symlinks
|
||||
ln -s sub/dir internal-link 2>/dev/null
|
||||
test_cd_to_toplevel internal-link 'at internal symbolic subdir' SYMLINKS
|
||||
|
||||
test_done
|
||||
|
||||
@@ -18,8 +18,12 @@ filesystem.
|
||||
. ./test-lib.sh
|
||||
|
||||
date >path0
|
||||
ln -s xyzzy path1
|
||||
test "$no_symlinks" && date > path1
|
||||
if test_have_prereq SYMLINKS
|
||||
then
|
||||
ln -s xyzzy path1
|
||||
else
|
||||
date > path1
|
||||
fi
|
||||
mkdir path2 path3 path4
|
||||
date >path2/file2
|
||||
date >path2-junk
|
||||
|
||||
@@ -37,15 +37,13 @@ modified without reporting path9 and path10.
|
||||
'
|
||||
. ./test-lib.sh
|
||||
|
||||
test "$no_symlinks" && {
|
||||
function ln () {
|
||||
test "$1" = -s && shift
|
||||
date > "$2"
|
||||
}
|
||||
}
|
||||
|
||||
date >path0
|
||||
ln -s xyzzy path1
|
||||
if test_have_prereq SYMLINKS
|
||||
then
|
||||
ln -s xyzzy path1
|
||||
else
|
||||
date > path1
|
||||
fi
|
||||
mkdir path2 path3
|
||||
date >path2/file2
|
||||
date >path3/file3
|
||||
@@ -59,8 +57,14 @@ test_expect_success \
|
||||
|
||||
rm -fr path? ;# leave path10 alone
|
||||
date >path2
|
||||
ln -s frotz path3
|
||||
ln -s nitfol path5
|
||||
if test_have_prereq SYMLINKS
|
||||
then
|
||||
ln -s frotz path3
|
||||
ln -s nitfol path5
|
||||
else
|
||||
date > path3
|
||||
date > path5
|
||||
fi
|
||||
mkdir path0 path1 path6
|
||||
date >path0/file0
|
||||
date >path1/file1
|
||||
|
||||
@@ -18,25 +18,25 @@ path2/baz. Also path0/ should snow nothing.
|
||||
'
|
||||
. ./test-lib.sh
|
||||
|
||||
test "$no_symlinks" && {
|
||||
function ln () {
|
||||
test "$1" = -s && shift
|
||||
date > "$2"
|
||||
}
|
||||
test_cmp () {
|
||||
sed s/^120000/100644/ < "$1" > "$1".doof
|
||||
diff "$1".doof "$2"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
test_expect_success \
|
||||
'setup' \
|
||||
'mkdir path2 path2/baz &&
|
||||
echo Hi >path0 &&
|
||||
ln -s path0 path1 &&
|
||||
if test_have_prereq SYMLINKS
|
||||
then
|
||||
ln -s path0 path1 &&
|
||||
ln -s ../path1 path2/bazbo
|
||||
make_expected () {
|
||||
cat >expected
|
||||
}
|
||||
else
|
||||
printf path0 > path1 &&
|
||||
printf ../path1 > path2/bazbo
|
||||
make_expected () {
|
||||
sed -e "s/120000 /100644 /" >expected
|
||||
}
|
||||
fi &&
|
||||
echo Lo >path2/foo &&
|
||||
ln -s ../path1 path2/bazbo &&
|
||||
echo Mi >path2/baz/b &&
|
||||
find path? \( -type f -o -type l \) -print |
|
||||
xargs git update-index --add &&
|
||||
@@ -53,7 +53,7 @@ test_output () {
|
||||
test_expect_success \
|
||||
'ls-tree plain' \
|
||||
'git ls-tree $tree >current &&
|
||||
cat >expected <<\EOF &&
|
||||
make_expected <<\EOF &&
|
||||
100644 blob X path0
|
||||
120000 blob X path1
|
||||
040000 tree X path2
|
||||
@@ -63,7 +63,7 @@ EOF
|
||||
test_expect_success \
|
||||
'ls-tree recursive' \
|
||||
'git ls-tree -r $tree >current &&
|
||||
cat >expected <<\EOF &&
|
||||
make_expected <<\EOF &&
|
||||
100644 blob X path0
|
||||
120000 blob X path1
|
||||
100644 blob X path2/baz/b
|
||||
@@ -75,7 +75,7 @@ EOF
|
||||
test_expect_success \
|
||||
'ls-tree recursive with -t' \
|
||||
'git ls-tree -r -t $tree >current &&
|
||||
cat >expected <<\EOF &&
|
||||
make_expected <<\EOF &&
|
||||
100644 blob X path0
|
||||
120000 blob X path1
|
||||
040000 tree X path2
|
||||
@@ -89,7 +89,7 @@ EOF
|
||||
test_expect_success \
|
||||
'ls-tree recursive with -d' \
|
||||
'git ls-tree -r -d $tree >current &&
|
||||
cat >expected <<\EOF &&
|
||||
make_expected <<\EOF &&
|
||||
040000 tree X path2
|
||||
040000 tree X path2/baz
|
||||
EOF
|
||||
@@ -98,7 +98,7 @@ EOF
|
||||
test_expect_success \
|
||||
'ls-tree filtered with path' \
|
||||
'git ls-tree $tree path >current &&
|
||||
cat >expected <<\EOF &&
|
||||
make_expected <<\EOF &&
|
||||
EOF
|
||||
test_output'
|
||||
|
||||
@@ -108,7 +108,7 @@ EOF
|
||||
test_expect_success \
|
||||
'ls-tree filtered with path1 path0' \
|
||||
'git ls-tree $tree path1 path0 >current &&
|
||||
cat >expected <<\EOF &&
|
||||
make_expected <<\EOF &&
|
||||
100644 blob X path0
|
||||
120000 blob X path1
|
||||
EOF
|
||||
@@ -117,7 +117,7 @@ EOF
|
||||
test_expect_success \
|
||||
'ls-tree filtered with path0/' \
|
||||
'git ls-tree $tree path0/ >current &&
|
||||
cat >expected <<\EOF &&
|
||||
make_expected <<\EOF &&
|
||||
EOF
|
||||
test_output'
|
||||
|
||||
@@ -126,7 +126,7 @@ EOF
|
||||
test_expect_success \
|
||||
'ls-tree filtered with path2' \
|
||||
'git ls-tree $tree path2 >current &&
|
||||
cat >expected <<\EOF &&
|
||||
make_expected <<\EOF &&
|
||||
040000 tree X path2
|
||||
EOF
|
||||
test_output'
|
||||
@@ -135,7 +135,7 @@ EOF
|
||||
test_expect_success \
|
||||
'ls-tree filtered with path2/' \
|
||||
'git ls-tree $tree path2/ >current &&
|
||||
cat >expected <<\EOF &&
|
||||
make_expected <<\EOF &&
|
||||
040000 tree X path2/baz
|
||||
120000 blob X path2/bazbo
|
||||
100644 blob X path2/foo
|
||||
@@ -147,7 +147,7 @@ EOF
|
||||
test_expect_success \
|
||||
'ls-tree filtered with path2/baz' \
|
||||
'git ls-tree $tree path2/baz >current &&
|
||||
cat >expected <<\EOF &&
|
||||
make_expected <<\EOF &&
|
||||
040000 tree X path2/baz
|
||||
EOF
|
||||
test_output'
|
||||
@@ -155,14 +155,14 @@ EOF
|
||||
test_expect_success \
|
||||
'ls-tree filtered with path2/bak' \
|
||||
'git ls-tree $tree path2/bak >current &&
|
||||
cat >expected <<\EOF &&
|
||||
make_expected <<\EOF &&
|
||||
EOF
|
||||
test_output'
|
||||
|
||||
test_expect_success \
|
||||
'ls-tree -t filtered with path2/bak' \
|
||||
'git ls-tree -t $tree path2/bak >current &&
|
||||
cat >expected <<\EOF &&
|
||||
make_expected <<\EOF &&
|
||||
040000 tree X path2
|
||||
EOF
|
||||
test_output'
|
||||
|
||||
@@ -121,15 +121,13 @@ test_expect_success 'renaming a symref is not allowed' \
|
||||
! test -f .git/refs/heads/master3
|
||||
'
|
||||
|
||||
test "$no_symlinks" || {
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'git branch -m u v should fail when the reflog for u is a symlink' '
|
||||
git branch -l u &&
|
||||
mv .git/logs/refs/heads/u real-u &&
|
||||
ln -s real-u .git/logs/refs/heads/u &&
|
||||
test_must_fail git branch -m u v
|
||||
'
|
||||
}
|
||||
|
||||
test_expect_success 'test tracking setup via --track' \
|
||||
'git config remote.local.url . &&
|
||||
|
||||
@@ -12,31 +12,37 @@ test_expect_success \
|
||||
'Initialize test directory' \
|
||||
"touch -- foo bar baz 'space embedded' -q &&
|
||||
git add -- foo bar baz 'space embedded' -q &&
|
||||
git commit -m 'add normal files' &&
|
||||
test_tabs=y &&
|
||||
if touch -- 'tab embedded' 'newline
|
||||
embedded'
|
||||
then
|
||||
git commit -m 'add normal files'"
|
||||
|
||||
if touch -- 'tab embedded' 'newline
|
||||
embedded' 2>/dev/null
|
||||
then
|
||||
test_set_prereq FUNNYNAMES
|
||||
else
|
||||
say 'Your filesystem does not allow tabs in filenames.'
|
||||
fi
|
||||
|
||||
test_expect_success FUNNYNAMES 'add files with funny names' "
|
||||
git add -- 'tab embedded' 'newline
|
||||
embedded' &&
|
||||
git commit -m 'add files with tabs and newlines'
|
||||
else
|
||||
test_tabs=n
|
||||
fi"
|
||||
|
||||
test "$test_tabs" = n && say 'Your filesystem does not allow tabs in filenames.'
|
||||
"
|
||||
|
||||
# Determine rm behavior
|
||||
# Later we will try removing an unremovable path to make sure
|
||||
# git rm barfs, but if the test is run as root that cannot be
|
||||
# arranged.
|
||||
test_expect_success \
|
||||
'Determine rm behavior' \
|
||||
': >test-file
|
||||
chmod a-w .
|
||||
rm -f test-file
|
||||
test -f test-file && test_failed_remove=y
|
||||
chmod 775 .
|
||||
rm -f test-file'
|
||||
: >test-file
|
||||
chmod a-w .
|
||||
rm -f test-file 2>/dev/null
|
||||
if test -f test-file
|
||||
then
|
||||
test_set_prereq RO_DIR
|
||||
else
|
||||
say 'skipping removal failure test (perhaps running as root?)'
|
||||
fi
|
||||
chmod 775 .
|
||||
rm -f test-file
|
||||
|
||||
test_expect_success \
|
||||
'Pre-check that foo exists and is in index before git rm foo' \
|
||||
@@ -101,20 +107,16 @@ test_expect_success \
|
||||
'Test that "git rm -- -q" succeeds (remove a file that looks like an option)' \
|
||||
'git rm -- -q'
|
||||
|
||||
test "$test_tabs" = y && test_expect_success \
|
||||
test_expect_success FUNNYNAMES \
|
||||
"Test that \"git rm -f\" succeeds with embedded space, tab, or newline characters." \
|
||||
"git rm -f 'space embedded' 'tab embedded' 'newline
|
||||
embedded'"
|
||||
|
||||
if test "$test_failed_remove" = y; then
|
||||
chmod a-w .
|
||||
test_expect_success \
|
||||
'Test that "git rm -f" fails if its rm fails' \
|
||||
'test_must_fail git rm -f baz'
|
||||
chmod 775 .
|
||||
else
|
||||
say 'skipping removal failure test (perhaps running as root?)'
|
||||
fi
|
||||
test_expect_success RO_DIR 'Test that "git rm -f" fails if its rm fails' '
|
||||
chmod a-w . &&
|
||||
test_must_fail git rm -f baz &&
|
||||
chmod 775 .
|
||||
'
|
||||
|
||||
test_expect_success \
|
||||
'When the rm in "git rm -f" fails, it should not remove the file from the index' \
|
||||
|
||||
@@ -30,8 +30,7 @@ test_expect_success \
|
||||
*) echo fail; git ls-files --stage xfoo1; (exit 1);;
|
||||
esac'
|
||||
|
||||
test "$no_symlinks" || {
|
||||
test_expect_success 'git add: filemode=0 should not get confused by symlink' '
|
||||
test_expect_success SYMLINKS 'git add: filemode=0 should not get confused by symlink' '
|
||||
rm -f xfoo1 &&
|
||||
ln -s foo xfoo1 &&
|
||||
git add xfoo1 &&
|
||||
@@ -40,7 +39,6 @@ test_expect_success 'git add: filemode=0 should not get confused by symlink' '
|
||||
*) echo fail; git ls-files --stage xfoo1; (exit 1);;
|
||||
esac
|
||||
'
|
||||
}
|
||||
|
||||
test_expect_success \
|
||||
'git update-index --add: Test that executable bit is not used...' \
|
||||
@@ -53,8 +51,7 @@ test_expect_success \
|
||||
*) echo fail; git ls-files --stage xfoo2; (exit 1);;
|
||||
esac'
|
||||
|
||||
test "$no_symlinks" || {
|
||||
test_expect_success 'git add: filemode=0 should not get confused by symlink' '
|
||||
test_expect_success SYMLINKS 'git add: filemode=0 should not get confused by symlink' '
|
||||
rm -f xfoo2 &&
|
||||
ln -s foo xfoo2 &&
|
||||
git update-index --add xfoo2 &&
|
||||
@@ -64,7 +61,7 @@ test_expect_success 'git add: filemode=0 should not get confused by symlink' '
|
||||
esac
|
||||
'
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'git update-index --add: Test that executable bit is not used...' \
|
||||
'git config core.filemode 0 &&
|
||||
ln -s xfoo2 xfoo3 &&
|
||||
@@ -73,7 +70,6 @@ test_expect_success \
|
||||
120000" "*xfoo3) echo ok;;
|
||||
*) echo fail; git ls-files --stage xfoo3; (exit 1);;
|
||||
esac'
|
||||
}
|
||||
|
||||
test_expect_success '.gitignore test setup' '
|
||||
echo "*.ig" >.gitignore &&
|
||||
@@ -183,12 +179,7 @@ test_expect_success 'git add --refresh' '
|
||||
test -z "`git diff-index HEAD -- foo`"
|
||||
'
|
||||
|
||||
if case $(uname -s) in *MINGW*) :;; *) false;; esac then
|
||||
say "chmod 0 does not make files unreadable - skipping tests"
|
||||
say "cannot have backslashes in file names - skipping test"
|
||||
else
|
||||
|
||||
test_expect_success 'git add should fail atomically upon an unreadable file' '
|
||||
test_expect_success POSIXPERM 'git add should fail atomically upon an unreadable file' '
|
||||
git reset --hard &&
|
||||
date >foo1 &&
|
||||
date >foo2 &&
|
||||
@@ -199,7 +190,7 @@ test_expect_success 'git add should fail atomically upon an unreadable file' '
|
||||
|
||||
rm -f foo2
|
||||
|
||||
test_expect_success 'git add --ignore-errors' '
|
||||
test_expect_success POSIXPERM 'git add --ignore-errors' '
|
||||
git reset --hard &&
|
||||
date >foo1 &&
|
||||
date >foo2 &&
|
||||
@@ -210,7 +201,7 @@ test_expect_success 'git add --ignore-errors' '
|
||||
|
||||
rm -f foo2
|
||||
|
||||
test_expect_success 'git add (add.ignore-errors)' '
|
||||
test_expect_success POSIXPERM 'git add (add.ignore-errors)' '
|
||||
git config add.ignore-errors 1 &&
|
||||
git reset --hard &&
|
||||
date >foo1 &&
|
||||
@@ -221,7 +212,7 @@ test_expect_success 'git add (add.ignore-errors)' '
|
||||
'
|
||||
rm -f foo2
|
||||
|
||||
test_expect_success 'git add (add.ignore-errors = false)' '
|
||||
test_expect_success POSIXPERM 'git add (add.ignore-errors = false)' '
|
||||
git config add.ignore-errors 0 &&
|
||||
git reset --hard &&
|
||||
date >foo1 &&
|
||||
@@ -231,7 +222,7 @@ test_expect_success 'git add (add.ignore-errors = false)' '
|
||||
! ( git ls-files foo1 | grep foo1 )
|
||||
'
|
||||
|
||||
test_expect_success 'git add '\''fo\[ou\]bar'\'' ignores foobar' '
|
||||
test_expect_success BSLASHPSPEC "git add 'fo\\[ou\\]bar' ignores foobar" '
|
||||
git reset --hard &&
|
||||
touch fo\[ou\]bar foobar &&
|
||||
git add '\''fo\[ou\]bar'\'' &&
|
||||
@@ -239,6 +230,4 @@ test_expect_success 'git add '\''fo\[ou\]bar'\'' ignores foobar' '
|
||||
! ( git ls-files foobar | grep foobar )
|
||||
'
|
||||
|
||||
fi # skip chmod 0 and bslash-in-filename tests
|
||||
|
||||
test_done
|
||||
|
||||
@@ -135,10 +135,12 @@ test_expect_success 'real edit works' '
|
||||
|
||||
if test "$(git config --bool core.filemode)" = false
|
||||
then
|
||||
say 'skipping filemode tests (filesystem does not properly support modes)'
|
||||
say 'skipping filemode tests (filesystem does not properly support modes)'
|
||||
else
|
||||
test_set_prereq FILEMODE
|
||||
fi
|
||||
|
||||
test_expect_success 'patch does not affect mode' '
|
||||
test_expect_success FILEMODE 'patch does not affect mode' '
|
||||
git reset --hard &&
|
||||
echo content >>file &&
|
||||
chmod +x file &&
|
||||
@@ -147,7 +149,7 @@ test_expect_success 'patch does not affect mode' '
|
||||
git diff file | grep "new mode"
|
||||
'
|
||||
|
||||
test_expect_success 'stage mode but not hunk' '
|
||||
test_expect_success FILEMODE 'stage mode but not hunk' '
|
||||
git reset --hard &&
|
||||
echo content >>file &&
|
||||
chmod +x file &&
|
||||
@@ -156,7 +158,6 @@ test_expect_success 'stage mode but not hunk' '
|
||||
git diff file | grep "+content"
|
||||
'
|
||||
|
||||
fi
|
||||
# end of tests disabled when filemode is not usable
|
||||
|
||||
test_done
|
||||
|
||||
@@ -12,11 +12,11 @@ by an edit for them.
|
||||
. ./test-lib.sh
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh
|
||||
|
||||
if test "$no_symlinks"
|
||||
if ! test_have_prereq SYMLINKS
|
||||
then
|
||||
say 'Symbolic links not supported, skipping tests.'
|
||||
test_done
|
||||
exit
|
||||
say 'Symbolic links not supported, skipping tests.'
|
||||
test_done
|
||||
exit
|
||||
fi
|
||||
|
||||
test_expect_success \
|
||||
|
||||
@@ -99,9 +99,7 @@ test_expect_success \
|
||||
'validate result of -B -M (#4)' \
|
||||
'compare_diff_raw expected current'
|
||||
|
||||
test "$no_symlinks" || {
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'make file0 into something completely different' \
|
||||
'rm -f file0 &&
|
||||
ln -s frotz file0 &&
|
||||
@@ -116,7 +114,7 @@ cat >expected <<\EOF
|
||||
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 M100 file1
|
||||
EOF
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'validate result of -B (#5)' \
|
||||
'compare_diff_raw expected current'
|
||||
|
||||
@@ -131,7 +129,7 @@ cat >expected <<\EOF
|
||||
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 R file0 file1
|
||||
EOF
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'validate result of -B -M (#6)' \
|
||||
'compare_diff_raw expected current'
|
||||
|
||||
@@ -146,12 +144,10 @@ cat >expected <<\EOF
|
||||
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 M file1
|
||||
EOF
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'validate result of -M (#7)' \
|
||||
'compare_diff_raw expected current'
|
||||
|
||||
} # end symlink tests
|
||||
|
||||
test_expect_success \
|
||||
'file1 edited to look like file0 and file0 rename-edited to file2' \
|
||||
'rm -f file0 file1 &&
|
||||
|
||||
@@ -9,11 +9,11 @@ test_description='Test diff of symlinks.
|
||||
. ./test-lib.sh
|
||||
. "$TEST_DIRECTORY"/diff-lib.sh
|
||||
|
||||
if test "$no_symlinks"
|
||||
if ! test_have_prereq SYMLINKS
|
||||
then
|
||||
say 'Symbolic links not supported, skipping tests.'
|
||||
test_done
|
||||
exit
|
||||
say 'Symbolic links not supported, skipping tests.'
|
||||
test_done
|
||||
exit
|
||||
fi
|
||||
|
||||
cat > expected << EOF
|
||||
|
||||
@@ -4,9 +4,11 @@ test_description='typechange rename detection'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
if test "$no_symlinks"; then
|
||||
say "symbolic links not supported - skipping test"
|
||||
test_done;
|
||||
if ! test_have_prereq SYMLINKS
|
||||
then
|
||||
say 'Symbolic links not supported, skipping tests.'
|
||||
test_done
|
||||
exit
|
||||
fi
|
||||
|
||||
test_expect_success setup '
|
||||
|
||||
@@ -31,14 +31,16 @@ test_expect_success setup \
|
||||
test_expect_success apply \
|
||||
'git apply --index --stat --summary --apply test-patch'
|
||||
|
||||
if [ "$(git config --get core.filemode)" = false ]
|
||||
if test "$(git config --bool core.filemode)" = false
|
||||
then
|
||||
say 'filemode disabled on the filesystem'
|
||||
else
|
||||
test_expect_success validate \
|
||||
'test -f bar && ls -l bar | grep "^-..x......"'
|
||||
test_set_prereq FILEMODE
|
||||
fi
|
||||
|
||||
test_expect_success FILEMODE validate \
|
||||
'test -f bar && ls -l bar | grep "^-..x......"'
|
||||
|
||||
test_expect_success 'apply reverse' \
|
||||
'git apply -R --index --stat --summary --apply test-patch &&
|
||||
test "$(cat foo)" = "This is foo"'
|
||||
|
||||
@@ -9,10 +9,12 @@ test_description='git apply should not get confused with type changes.
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
test "$no_symlinks" && {
|
||||
say "Symbolic links not supported - skipping tests"
|
||||
if ! test_have_prereq SYMLINKS
|
||||
then
|
||||
say 'Symbolic links not supported, skipping tests.'
|
||||
test_done
|
||||
}
|
||||
exit
|
||||
fi
|
||||
|
||||
test_expect_success 'setup repository and commits' '
|
||||
echo "hello world" > foo &&
|
||||
|
||||
@@ -9,11 +9,11 @@ test_description='git apply symlinks and partial files
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
if test "$no_symlinks"
|
||||
if ! test_have_prereq SYMLINKS
|
||||
then
|
||||
say 'Symbolic links not supported, skipping tests.'
|
||||
test_done
|
||||
exit
|
||||
say 'Symbolic links not supported, skipping tests.'
|
||||
test_done
|
||||
exit
|
||||
fi
|
||||
|
||||
test_expect_success setup '
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
test_description='apply to deeper directory without getting fooled with symlink'
|
||||
. ./test-lib.sh
|
||||
|
||||
if test "$no_symlinks"
|
||||
if ! test_have_prereq SYMLINKS
|
||||
then
|
||||
say 'Symbolic links not supported, skipping tests.'
|
||||
test_done
|
||||
|
||||
@@ -4,8 +4,12 @@ test_description='applying patch with mode bits'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
say "executable mode not supported - skipping tests"
|
||||
test_done
|
||||
if test "$(git config --bool core.filemode)" = false
|
||||
then
|
||||
say 'filemode disabled on the filesystem'
|
||||
else
|
||||
test_set_prereq FILEMODE
|
||||
fi
|
||||
|
||||
test_expect_success setup '
|
||||
echo original >file &&
|
||||
@@ -19,14 +23,14 @@ test_expect_success setup '
|
||||
git diff --stat -p >patch-1.txt
|
||||
'
|
||||
|
||||
test_expect_success 'same mode (no index)' '
|
||||
test_expect_success FILEMODE 'same mode (no index)' '
|
||||
git reset --hard &&
|
||||
chmod +x file &&
|
||||
git apply patch-0.txt &&
|
||||
test -x file
|
||||
'
|
||||
|
||||
test_expect_success 'same mode (with index)' '
|
||||
test_expect_success FILEMODE 'same mode (with index)' '
|
||||
git reset --hard &&
|
||||
chmod +x file &&
|
||||
git add file &&
|
||||
@@ -35,7 +39,7 @@ test_expect_success 'same mode (with index)' '
|
||||
git diff --exit-code
|
||||
'
|
||||
|
||||
test_expect_success 'same mode (index only)' '
|
||||
test_expect_success FILEMODE 'same mode (index only)' '
|
||||
git reset --hard &&
|
||||
chmod +x file &&
|
||||
git add file &&
|
||||
@@ -43,20 +47,20 @@ test_expect_success 'same mode (index only)' '
|
||||
git ls-files -s file | grep "^100755"
|
||||
'
|
||||
|
||||
test_expect_success 'mode update (no index)' '
|
||||
test_expect_success FILEMODE 'mode update (no index)' '
|
||||
git reset --hard &&
|
||||
git apply patch-1.txt &&
|
||||
test -x file
|
||||
'
|
||||
|
||||
test_expect_success 'mode update (with index)' '
|
||||
test_expect_success FILEMODE 'mode update (with index)' '
|
||||
git reset --hard &&
|
||||
git apply --index patch-1.txt &&
|
||||
test -x file &&
|
||||
git diff --exit-code
|
||||
'
|
||||
|
||||
test_expect_success 'mode update (index only)' '
|
||||
test_expect_success FILEMODE 'mode update (index only)' '
|
||||
git reset --hard &&
|
||||
git apply --cached patch-1.txt &&
|
||||
git ls-files -s file | grep "^100755"
|
||||
|
||||
@@ -27,13 +27,6 @@ commit id embedding:
|
||||
. ./test-lib.sh
|
||||
UNZIP=${UNZIP:-unzip}
|
||||
|
||||
test "$no_symlinks" && {
|
||||
function ln () {
|
||||
test "$1" = -s && shift
|
||||
date > "$2"
|
||||
}
|
||||
}
|
||||
|
||||
SUBSTFORMAT=%H%n
|
||||
|
||||
test_expect_success \
|
||||
@@ -44,7 +37,11 @@ test_expect_success \
|
||||
cp /bin/sh a/bin &&
|
||||
printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
|
||||
printf "A not substituted O" >a/substfile2 &&
|
||||
ln -s a a/l1 &&
|
||||
if test_have_prereq SYMLINKS; then
|
||||
ln -s a a/l1
|
||||
else
|
||||
printf %s a > a/l1
|
||||
fi &&
|
||||
(p=long_path_to_a_file && cd a &&
|
||||
for depth in 1 2 3 4 5; do mkdir $p && cd $p; done &&
|
||||
echo text >file_with_long_path) &&
|
||||
@@ -190,20 +187,20 @@ test_expect_success 'git archive --format=zip with --output' \
|
||||
$UNZIP -v >/dev/null 2>&1
|
||||
if [ $? -eq 127 ]; then
|
||||
say "Skipping ZIP tests, because unzip was not found"
|
||||
test_done
|
||||
exit
|
||||
else
|
||||
test_set_prereq UNZIP
|
||||
fi
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success UNZIP \
|
||||
'extract ZIP archive' \
|
||||
'(mkdir d && cd d && $UNZIP ../d.zip)'
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success UNZIP \
|
||||
'validate filenames' \
|
||||
'(cd d/a && find .) | sort >d.lst &&
|
||||
test_cmp a.lst d.lst'
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success UNZIP \
|
||||
'validate file contents' \
|
||||
'diff -r a d/a'
|
||||
|
||||
@@ -211,16 +208,16 @@ test_expect_success \
|
||||
'git archive --format=zip with prefix' \
|
||||
'git archive --format=zip --prefix=prefix/ HEAD >e.zip'
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success UNZIP \
|
||||
'extract ZIP archive with prefix' \
|
||||
'(mkdir e && cd e && $UNZIP ../e.zip)'
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success UNZIP \
|
||||
'validate filenames with prefix' \
|
||||
'(cd e/prefix/a && find .) | sort >e.lst &&
|
||||
test_cmp a.lst e.lst'
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success UNZIP \
|
||||
'validate file contents with prefix' \
|
||||
'diff -r a e/prefix/a'
|
||||
|
||||
|
||||
@@ -69,32 +69,27 @@ test_expect_success \
|
||||
'index v2: force some 64-bit offsets with pack-objects' \
|
||||
'pack3=$(git pack-objects --index-version=2,0x40000 test-3 <obj-list)'
|
||||
|
||||
have_64bits=
|
||||
if msg=$(git verify-pack -v "test-3-${pack3}.pack" 2>&1) ||
|
||||
! (echo "$msg" | grep "pack too large .* off_t")
|
||||
then
|
||||
have_64bits=t
|
||||
test_set_prereq OFF64_T
|
||||
else
|
||||
say "skipping tests concerning 64-bit offsets"
|
||||
fi
|
||||
|
||||
test "$have_64bits" &&
|
||||
test_expect_success \
|
||||
test_expect_success OFF64_T \
|
||||
'index v2: verify a pack with some 64-bit offsets' \
|
||||
'git verify-pack -v "test-3-${pack3}.pack"'
|
||||
|
||||
test "$have_64bits" &&
|
||||
test_expect_success \
|
||||
test_expect_success OFF64_T \
|
||||
'64-bit offsets: should be different from previous index v2 results' \
|
||||
'! cmp "test-2-${pack2}.idx" "test-3-${pack3}.idx"'
|
||||
|
||||
test "$have_64bits" &&
|
||||
test_expect_success \
|
||||
test_expect_success OFF64_T \
|
||||
'index v2: force some 64-bit offsets with index-pack' \
|
||||
'git index-pack --index-version=2,0x40000 -o 3.idx "test-1-${pack1}.pack"'
|
||||
|
||||
test "$have_64bits" &&
|
||||
test_expect_success \
|
||||
test_expect_success OFF64_T \
|
||||
'64-bit offsets: index-pack result should match pack-objects one' \
|
||||
'cmp "test-3-${pack3}.idx" "3.idx"'
|
||||
|
||||
|
||||
@@ -4,6 +4,13 @@ test_description='test automatic tag following'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
case $(uname -s) in
|
||||
*MINGW*)
|
||||
say "GIT_DEBUG_SEND_PACK not supported - skipping tests"
|
||||
test_done
|
||||
exit
|
||||
esac
|
||||
|
||||
# End state of the repository:
|
||||
#
|
||||
# T - tag1 S - tag2
|
||||
@@ -41,12 +48,7 @@ cat - <<EOF >expect
|
||||
want $A
|
||||
#E
|
||||
EOF
|
||||
|
||||
case $(uname -s) in
|
||||
*MINGW*) test_expect=test_expect_failure;;
|
||||
*) test_expect=test_expect_success;;
|
||||
esac
|
||||
$test_expect 'fetch A (new commit : 1 connection)' '
|
||||
test_expect_success 'fetch A (new commit : 1 connection)' '
|
||||
rm -f $U
|
||||
(
|
||||
cd cloned &&
|
||||
@@ -76,11 +78,7 @@ want $C
|
||||
want $T
|
||||
#E
|
||||
EOF
|
||||
case $(uname -s) in
|
||||
*MINGW*) test_expect=test_expect_failure;;
|
||||
*) test_expect=test_expect_success;;
|
||||
esac
|
||||
$test_expect 'fetch C, T (new branch, tag : 1 connection)' '
|
||||
test_expect_success 'fetch C, T (new branch, tag : 1 connection)' '
|
||||
rm -f $U
|
||||
(
|
||||
cd cloned &&
|
||||
@@ -116,11 +114,7 @@ want $B
|
||||
want $S
|
||||
#E
|
||||
EOF
|
||||
case $(uname -s) in
|
||||
*MINGW*) test_expect=test_expect_failure;;
|
||||
*) test_expect=test_expect_success;;
|
||||
esac
|
||||
$test_expect 'fetch B, S (commit and tag : 1 connection)' '
|
||||
test_expect_success 'fetch B, S (commit and tag : 1 connection)' '
|
||||
rm -f $U
|
||||
(
|
||||
cd cloned &&
|
||||
@@ -140,11 +134,7 @@ want $B
|
||||
want $S
|
||||
#E
|
||||
EOF
|
||||
case $(uname -s) in
|
||||
*MINGW*) test_expect=test_expect_failure;;
|
||||
*) test_expect=test_expect_success;;
|
||||
esac
|
||||
$test_expect 'new clone fetch master and tags' '
|
||||
test_expect_success 'new clone fetch master and tags' '
|
||||
git branch -D cat
|
||||
rm -f $U
|
||||
(
|
||||
|
||||
@@ -4,9 +4,11 @@ test_description='pulling from symlinked subdir'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
if test "$no_symlinks"; then
|
||||
say "symbolic links not supported - skipping tests"
|
||||
if ! test_have_prereq SYMLINKS
|
||||
then
|
||||
say 'Symbolic links not supported, skipping tests.'
|
||||
test_done
|
||||
exit
|
||||
fi
|
||||
|
||||
# The scenario we are building:
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
test_description='merge-recursive: handle file mode'
|
||||
. ./test-lib.sh
|
||||
|
||||
if ! test "$(git config --bool core.filemode)" = false
|
||||
then
|
||||
test_set_prereq FILEMODE
|
||||
fi
|
||||
|
||||
test_expect_success 'mode change in one branch: keep changed version' '
|
||||
: >file1 &&
|
||||
git add file1 &&
|
||||
@@ -16,7 +21,11 @@ test_expect_success 'mode change in one branch: keep changed version' '
|
||||
git commit -m b1 &&
|
||||
git checkout a1 &&
|
||||
git merge-recursive master -- a1 b1 &&
|
||||
{ test -x file1 || git ls-files -s file1 | grep ^100755; }
|
||||
git ls-files -s file1 | grep ^100755
|
||||
'
|
||||
|
||||
test_expect_success FILEMODE 'verify executable bit on file' '
|
||||
test -x file1
|
||||
'
|
||||
|
||||
test_expect_success 'mode change in both branches: expect conflict' '
|
||||
@@ -41,7 +50,11 @@ test_expect_success 'mode change in both branches: expect conflict' '
|
||||
echo "100644 $H 3 file2"
|
||||
) >expect &&
|
||||
test_cmp actual expect &&
|
||||
{ test -x file2 || git ls-files -s file2 | grep ^100755; }
|
||||
git ls-files -s file2 | grep ^100755
|
||||
'
|
||||
|
||||
test_expect_success FILEMODE 'verify executable bit on file' '
|
||||
test -x file2
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -206,8 +206,7 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' '
|
||||
|
||||
rm -f dirty dirty2
|
||||
|
||||
test "$no_symlinks" ||
|
||||
test_expect_success 'git mv should overwrite symlink to a file' '
|
||||
test_expect_success SYMLINKS 'git mv should overwrite symlink to a file' '
|
||||
|
||||
rm -fr .git &&
|
||||
git init &&
|
||||
@@ -226,8 +225,7 @@ test_expect_success 'git mv should overwrite symlink to a file' '
|
||||
|
||||
rm -f moved symlink
|
||||
|
||||
test "$no_symlinks" ||
|
||||
test_expect_success 'git mv should overwrite file with a symlink' '
|
||||
test_expect_success SYMLINKS 'git mv should overwrite file with a symlink' '
|
||||
|
||||
rm -fr .git &&
|
||||
git init &&
|
||||
|
||||
@@ -581,28 +581,38 @@ test_expect_success \
|
||||
'
|
||||
|
||||
# subsequent tests require gpg; check if it is available
|
||||
gpg --version >/dev/null
|
||||
gpg --version >/dev/null 2>/dev/null
|
||||
if [ $? -eq 127 ]; then
|
||||
say "gpg not found - skipping tag signing and verification tests"
|
||||
test_done
|
||||
exit
|
||||
else
|
||||
# As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
|
||||
# the gpg version 1.0.6 didn't parse trust packets correctly, so for
|
||||
# that version, creation of signed tags using the generated key fails.
|
||||
case "$(gpg --version)" in
|
||||
'gpg (GnuPG) 1.0.6'*)
|
||||
say "Skipping signed tag tests, because a bug in 1.0.6 version"
|
||||
;;
|
||||
*)
|
||||
test_set_prereq GPG
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# trying to verify annotated non-signed tags:
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'trying to verify an annotated non-signed tag should fail' '
|
||||
tag_exists annotated-tag &&
|
||||
test_must_fail git tag -v annotated-tag
|
||||
'
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'trying to verify a file-annotated non-signed tag should fail' '
|
||||
tag_exists file-annotated-tag &&
|
||||
test_must_fail git tag -v file-annotated-tag
|
||||
'
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'trying to verify two annotated non-signed tags should fail' '
|
||||
tag_exists annotated-tag file-annotated-tag &&
|
||||
test_must_fail git tag -v annotated-tag file-annotated-tag
|
||||
@@ -610,17 +620,6 @@ test_expect_success \
|
||||
|
||||
# creating and verifying signed tags:
|
||||
|
||||
# As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
|
||||
# the gpg version 1.0.6 didn't parse trust packets correctly, so for
|
||||
# that version, creation of signed tags using the generated key fails.
|
||||
case "$(gpg --version)" in
|
||||
'gpg (GnuPG) 1.0.6'*)
|
||||
say "Skipping signed tag tests, because a bug in 1.0.6 version"
|
||||
test_done
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
# key generation info: gpg --homedir t/t7004 --gen-key
|
||||
# Type DSA and Elgamal, size 2048 bits, no expiration date.
|
||||
# Name and email: C O Mitter <committer@example.com>
|
||||
@@ -634,7 +633,7 @@ export GNUPGHOME
|
||||
get_tag_header signed-tag $commit commit $time >expect
|
||||
echo 'A signed tag message' >>expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success 'creating a signed tag with -m message should succeed' '
|
||||
test_expect_success GPG 'creating a signed tag with -m message should succeed' '
|
||||
git tag -s -m "A signed tag message" signed-tag &&
|
||||
get_tag_msg signed-tag >actual &&
|
||||
test_cmp expect actual
|
||||
@@ -643,7 +642,7 @@ test_expect_success 'creating a signed tag with -m message should succeed' '
|
||||
get_tag_header u-signed-tag $commit commit $time >expect
|
||||
echo 'Another message' >>expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success 'sign with a given key id' '
|
||||
test_expect_success GPG 'sign with a given key id' '
|
||||
|
||||
git tag -u committer@example.com -m "Another message" u-signed-tag &&
|
||||
get_tag_msg u-signed-tag >actual &&
|
||||
@@ -651,14 +650,14 @@ test_expect_success 'sign with a given key id' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'sign with an unknown id (1)' '
|
||||
test_expect_success GPG 'sign with an unknown id (1)' '
|
||||
|
||||
test_must_fail git tag -u author@example.com \
|
||||
-m "Another message" o-signed-tag
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'sign with an unknown id (2)' '
|
||||
test_expect_success GPG 'sign with an unknown id (2)' '
|
||||
|
||||
test_must_fail git tag -u DEADBEEF -m "Another message" o-signed-tag
|
||||
|
||||
@@ -675,7 +674,7 @@ chmod +x fakeeditor
|
||||
get_tag_header implied-sign $commit commit $time >expect
|
||||
./fakeeditor >>expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success '-u implies signed tag' '
|
||||
test_expect_success GPG '-u implies signed tag' '
|
||||
GIT_EDITOR=./fakeeditor git tag -u CDDE430D implied-sign &&
|
||||
get_tag_msg implied-sign >actual &&
|
||||
test_cmp expect actual
|
||||
@@ -688,7 +687,7 @@ EOF
|
||||
get_tag_header file-signed-tag $commit commit $time >expect
|
||||
cat sigmsgfile >>expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag with -F messagefile should succeed' '
|
||||
git tag -s -F sigmsgfile file-signed-tag &&
|
||||
get_tag_msg file-signed-tag >actual &&
|
||||
@@ -702,7 +701,7 @@ EOF
|
||||
get_tag_header stdin-signed-tag $commit commit $time >expect
|
||||
cat siginputmsg >>expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success 'creating a signed tag with -F - should succeed' '
|
||||
test_expect_success GPG 'creating a signed tag with -F - should succeed' '
|
||||
git tag -s -F - stdin-signed-tag <siginputmsg &&
|
||||
get_tag_msg stdin-signed-tag >actual &&
|
||||
test_cmp expect actual
|
||||
@@ -711,13 +710,13 @@ test_expect_success 'creating a signed tag with -F - should succeed' '
|
||||
get_tag_header implied-annotate $commit commit $time >expect
|
||||
./fakeeditor >>expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success '-s implies annotated tag' '
|
||||
test_expect_success GPG '-s implies annotated tag' '
|
||||
GIT_EDITOR=./fakeeditor git tag -s implied-annotate &&
|
||||
get_tag_msg implied-annotate >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'trying to create a signed tag with non-existing -F file should fail' '
|
||||
! test -f nonexistingfile &&
|
||||
! tag_exists nosigtag &&
|
||||
@@ -725,13 +724,13 @@ test_expect_success \
|
||||
! tag_exists nosigtag
|
||||
'
|
||||
|
||||
test_expect_success 'verifying a signed tag should succeed' \
|
||||
test_expect_success GPG 'verifying a signed tag should succeed' \
|
||||
'git tag -v signed-tag'
|
||||
|
||||
test_expect_success 'verifying two signed tags in one command should succeed' \
|
||||
test_expect_success GPG 'verifying two signed tags in one command should succeed' \
|
||||
'git tag -v signed-tag file-signed-tag'
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'verifying many signed and non-signed tags should fail' '
|
||||
test_must_fail git tag -v signed-tag annotated-tag &&
|
||||
test_must_fail git tag -v file-annotated-tag file-signed-tag &&
|
||||
@@ -740,7 +739,7 @@ test_expect_success \
|
||||
test_must_fail git tag -v signed-tag annotated-tag file-signed-tag
|
||||
'
|
||||
|
||||
test_expect_success 'verifying a forged tag should fail' '
|
||||
test_expect_success GPG 'verifying a forged tag should fail' '
|
||||
forged=$(git cat-file tag signed-tag |
|
||||
sed -e "s/signed-tag/forged-tag/" |
|
||||
git mktag) &&
|
||||
@@ -752,7 +751,7 @@ test_expect_success 'verifying a forged tag should fail' '
|
||||
|
||||
get_tag_header empty-signed-tag $commit commit $time >expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag with an empty -m message should succeed' '
|
||||
git tag -s -m "" empty-signed-tag &&
|
||||
get_tag_msg empty-signed-tag >actual &&
|
||||
@@ -763,7 +762,7 @@ test_expect_success \
|
||||
>sigemptyfile
|
||||
get_tag_header emptyfile-signed-tag $commit commit $time >expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag with an empty -F messagefile should succeed' '
|
||||
git tag -s -F sigemptyfile emptyfile-signed-tag &&
|
||||
get_tag_msg emptyfile-signed-tag >actual &&
|
||||
@@ -786,7 +785,7 @@ Trailing spaces
|
||||
Trailing blank lines
|
||||
EOF
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'extra blanks in the message for a signed tag should be removed' '
|
||||
git tag -s -F sigblanksfile blanks-signed-tag &&
|
||||
get_tag_msg blanks-signed-tag >actual &&
|
||||
@@ -796,7 +795,7 @@ test_expect_success \
|
||||
|
||||
get_tag_header blank-signed-tag $commit commit $time >expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag with a blank -m message should succeed' '
|
||||
git tag -s -m " " blank-signed-tag &&
|
||||
get_tag_msg blank-signed-tag >actual &&
|
||||
@@ -809,7 +808,7 @@ echo '' >>sigblankfile
|
||||
echo ' ' >>sigblankfile
|
||||
get_tag_header blankfile-signed-tag $commit commit $time >expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag with blank -F file with spaces should succeed' '
|
||||
git tag -s -F sigblankfile blankfile-signed-tag &&
|
||||
get_tag_msg blankfile-signed-tag >actual &&
|
||||
@@ -820,7 +819,7 @@ test_expect_success \
|
||||
printf ' ' >sigblanknonlfile
|
||||
get_tag_header blanknonlfile-signed-tag $commit commit $time >expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag with spaces and no newline should succeed' '
|
||||
git tag -s -F sigblanknonlfile blanknonlfile-signed-tag &&
|
||||
get_tag_msg blanknonlfile-signed-tag >actual &&
|
||||
@@ -857,7 +856,7 @@ Another line.
|
||||
Last line.
|
||||
EOF
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag with a -F file with #comments should succeed' '
|
||||
git tag -s -F sigcommentsfile comments-signed-tag &&
|
||||
get_tag_msg comments-signed-tag >actual &&
|
||||
@@ -867,7 +866,7 @@ test_expect_success \
|
||||
|
||||
get_tag_header comment-signed-tag $commit commit $time >expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag with #commented -m message should succeed' '
|
||||
git tag -s -m "#comment" comment-signed-tag &&
|
||||
get_tag_msg comment-signed-tag >actual &&
|
||||
@@ -880,7 +879,7 @@ echo '' >>sigcommentfile
|
||||
echo '####' >>sigcommentfile
|
||||
get_tag_header commentfile-signed-tag $commit commit $time >expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag with #commented -F messagefile should succeed' '
|
||||
git tag -s -F sigcommentfile commentfile-signed-tag &&
|
||||
get_tag_msg commentfile-signed-tag >actual &&
|
||||
@@ -891,7 +890,7 @@ test_expect_success \
|
||||
printf '#comment' >sigcommentnonlfile
|
||||
get_tag_header commentnonlfile-signed-tag $commit commit $time >expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag with a #comment and no newline should succeed' '
|
||||
git tag -s -F sigcommentnonlfile commentnonlfile-signed-tag &&
|
||||
get_tag_msg commentnonlfile-signed-tag >actual &&
|
||||
@@ -901,7 +900,7 @@ test_expect_success \
|
||||
|
||||
# listing messages for signed tags:
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'listing the one-line message of a signed tag should succeed' '
|
||||
git tag -s -m "A message line signed" stag-one-line &&
|
||||
|
||||
@@ -926,7 +925,7 @@ test_expect_success \
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'listing the zero-lines message of a signed tag should succeed' '
|
||||
git tag -s -m "" stag-zero-lines &&
|
||||
|
||||
@@ -954,7 +953,7 @@ test_expect_success \
|
||||
echo 'stag line one' >sigtagmsg
|
||||
echo 'stag line two' >>sigtagmsg
|
||||
echo 'stag line three' >>sigtagmsg
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'listing many message lines of a signed tag should succeed' '
|
||||
git tag -s -F sigtagmsg stag-lines &&
|
||||
|
||||
@@ -999,12 +998,12 @@ test_expect_success \
|
||||
|
||||
tree=$(git rev-parse HEAD^{tree})
|
||||
blob=$(git rev-parse HEAD:foo)
|
||||
tag=$(git rev-parse signed-tag)
|
||||
tag=$(git rev-parse signed-tag 2>/dev/null)
|
||||
|
||||
get_tag_header tree-signed-tag $tree tree $time >expect
|
||||
echo "A message for a tree" >>expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag pointing to a tree should succeed' '
|
||||
git tag -s -m "A message for a tree" tree-signed-tag HEAD^{tree} &&
|
||||
get_tag_msg tree-signed-tag >actual &&
|
||||
@@ -1014,7 +1013,7 @@ test_expect_success \
|
||||
get_tag_header blob-signed-tag $blob blob $time >expect
|
||||
echo "A message for a blob" >>expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag pointing to a blob should succeed' '
|
||||
git tag -s -m "A message for a blob" blob-signed-tag HEAD:foo &&
|
||||
get_tag_msg blob-signed-tag >actual &&
|
||||
@@ -1024,7 +1023,7 @@ test_expect_success \
|
||||
get_tag_header tag-signed-tag $tag tag $time >expect
|
||||
echo "A message for another tag" >>expect
|
||||
echo '-----BEGIN PGP SIGNATURE-----' >>expect
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'creating a signed tag pointing to another tag should succeed' '
|
||||
git tag -s -m "A message for another tag" tag-signed-tag signed-tag &&
|
||||
get_tag_msg tag-signed-tag >actual &&
|
||||
@@ -1033,7 +1032,7 @@ test_expect_success \
|
||||
|
||||
# try to sign with bad user.signingkey
|
||||
git config user.signingkey BobTheMouse
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'git tag -s fails if gpg is misconfigured' \
|
||||
'test_must_fail git tag -s -m tail tag-gpg-failure'
|
||||
git config --unset user.signingkey
|
||||
@@ -1041,7 +1040,7 @@ git config --unset user.signingkey
|
||||
# try to verify without gpg:
|
||||
|
||||
rm -rf gpghome
|
||||
test_expect_success \
|
||||
test_expect_success GPG \
|
||||
'verify signed tag fails when public key is not present' \
|
||||
'test_must_fail git tag -v signed-tag'
|
||||
|
||||
|
||||
@@ -69,11 +69,7 @@ test_expect_success '--no-verify with failing hook' '
|
||||
'
|
||||
|
||||
chmod -x "$HOOK"
|
||||
if test "$(git config --bool core.filemode)" = false; then
|
||||
say "executable bit not honored - skipping tests of non-executable hook"
|
||||
else
|
||||
|
||||
test_expect_success 'with non-executable hook' '
|
||||
test_expect_success POSIXPERM 'with non-executable hook' '
|
||||
|
||||
echo "content" >> file &&
|
||||
git add file &&
|
||||
@@ -81,7 +77,7 @@ test_expect_success 'with non-executable hook' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success '--no-verify with non-executable hook' '
|
||||
test_expect_success POSIXPERM '--no-verify with non-executable hook' '
|
||||
|
||||
echo "more content" >> file &&
|
||||
git add file &&
|
||||
@@ -89,6 +85,4 @@ test_expect_success '--no-verify with non-executable hook' '
|
||||
|
||||
'
|
||||
|
||||
fi # non-executable hooks
|
||||
|
||||
test_done
|
||||
|
||||
@@ -136,11 +136,7 @@ test_expect_success '--no-verify with failing hook (editor)' '
|
||||
'
|
||||
|
||||
chmod -x "$HOOK"
|
||||
if test "$(git config --bool core.filemode)" = false; then
|
||||
say "executable bit not honored - skipping tests of non-executable hook"
|
||||
else
|
||||
|
||||
test_expect_success 'with non-executable hook' '
|
||||
test_expect_success POSIXPERM 'with non-executable hook' '
|
||||
|
||||
echo "content" >> file &&
|
||||
git add file &&
|
||||
@@ -148,7 +144,7 @@ test_expect_success 'with non-executable hook' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'with non-executable hook (editor)' '
|
||||
test_expect_success POSIXPERM 'with non-executable hook (editor)' '
|
||||
|
||||
echo "content again" >> file &&
|
||||
git add file &&
|
||||
@@ -157,7 +153,7 @@ test_expect_success 'with non-executable hook (editor)' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success '--no-verify with non-executable hook' '
|
||||
test_expect_success POSIXPERM '--no-verify with non-executable hook' '
|
||||
|
||||
echo "more content" >> file &&
|
||||
git add file &&
|
||||
@@ -165,7 +161,7 @@ test_expect_success '--no-verify with non-executable hook' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success '--no-verify with non-executable hook (editor)' '
|
||||
test_expect_success POSIXPERM '--no-verify with non-executable hook (editor)' '
|
||||
|
||||
echo "even more content" >> file &&
|
||||
git add file &&
|
||||
@@ -174,8 +170,6 @@ test_expect_success '--no-verify with non-executable hook (editor)' '
|
||||
|
||||
'
|
||||
|
||||
fi # non-executable hooks
|
||||
|
||||
# now a hook that edits the commit message
|
||||
cat > "$HOOK" <<'EOF'
|
||||
#!/bin/sh
|
||||
|
||||
@@ -6,19 +6,19 @@
|
||||
test_description='git svn basic tests'
|
||||
GIT_SVN_LC_ALL=${LC_ALL:-$LANG}
|
||||
|
||||
case "$GIT_SVN_LC_ALL" in
|
||||
*.UTF-8)
|
||||
have_utf8=t
|
||||
;;
|
||||
*)
|
||||
have_utf8=
|
||||
;;
|
||||
esac
|
||||
|
||||
. ./lib-git-svn.sh
|
||||
|
||||
say 'define NO_SVN_TESTS to skip git svn tests'
|
||||
|
||||
case "$GIT_SVN_LC_ALL" in
|
||||
*.UTF-8)
|
||||
test_set_prereq UTF8
|
||||
;;
|
||||
*)
|
||||
say "UTF-8 locale not set, some tests skipped ($GIT_SVN_LC_ALL)"
|
||||
;;
|
||||
esac
|
||||
|
||||
test_expect_success \
|
||||
'initialize git svn' '
|
||||
mkdir import &&
|
||||
@@ -171,20 +171,15 @@ test_expect_success "$name" '
|
||||
test ! -L "$SVN_TREE"/exec-2.sh &&
|
||||
test_cmp help "$SVN_TREE"/exec-2.sh'
|
||||
|
||||
if test "$have_utf8" = t
|
||||
then
|
||||
name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
|
||||
LC_ALL="$GIT_SVN_LC_ALL"
|
||||
export LC_ALL
|
||||
test_expect_success "$name" "
|
||||
echo '# hello' >> exec-2.sh &&
|
||||
git update-index exec-2.sh &&
|
||||
git commit -m 'éï∏' &&
|
||||
git svn set-tree HEAD"
|
||||
unset LC_ALL
|
||||
else
|
||||
say "UTF-8 locale not set, test skipped ($GIT_SVN_LC_ALL)"
|
||||
fi
|
||||
name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
|
||||
LC_ALL="$GIT_SVN_LC_ALL"
|
||||
export LC_ALL
|
||||
test_expect_success UTF8 "$name" "
|
||||
echo '# hello' >> exec-2.sh &&
|
||||
git update-index exec-2.sh &&
|
||||
git commit -m 'éï∏' &&
|
||||
git svn set-tree HEAD"
|
||||
unset LC_ALL
|
||||
|
||||
name='test fetch functionality (svn => git) with alternate GIT_SVN_ID'
|
||||
GIT_SVN_ID=alt
|
||||
@@ -197,7 +192,7 @@ test_expect_success "$name" \
|
||||
|
||||
name='check imported tree checksums expected tree checksums'
|
||||
rm -f expected
|
||||
if test "$have_utf8" = t
|
||||
if test_have_prereq UTF8
|
||||
then
|
||||
echo tree bf522353586b1b883488f2bc73dab0d9f774b9a9 > expected
|
||||
fi
|
||||
|
||||
@@ -70,24 +70,26 @@ do
|
||||
done
|
||||
|
||||
if locale -a |grep -q en_US.utf8; then
|
||||
test_expect_success 'ISO-8859-1 should match UTF-8 in svn' '
|
||||
(
|
||||
cd ISO-8859-1 &&
|
||||
compare_svn_head_with "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
|
||||
)
|
||||
'
|
||||
|
||||
for H in EUCJP ISO-2022-JP
|
||||
do
|
||||
test_expect_success '$H should match UTF-8 in svn' '
|
||||
(
|
||||
cd $H &&
|
||||
compare_svn_head_with "$TEST_DIRECTORY"/t3900/2-UTF-8.txt
|
||||
)
|
||||
'
|
||||
done
|
||||
test_set_prereq UTF8
|
||||
else
|
||||
say "UTF-8 locale not available, test skipped"
|
||||
fi
|
||||
|
||||
test_expect_success UTF8 'ISO-8859-1 should match UTF-8 in svn' '
|
||||
(
|
||||
cd ISO-8859-1 &&
|
||||
compare_svn_head_with "$TEST_DIRECTORY"/t3900/1-UTF-8.txt
|
||||
)
|
||||
'
|
||||
|
||||
for H in EUCJP ISO-2022-JP
|
||||
do
|
||||
test_expect_success UTF8 "$H should match UTF-8 in svn" '
|
||||
(
|
||||
cd $H &&
|
||||
compare_svn_head_with "$TEST_DIRECTORY"/t3900/2-UTF-8.txt
|
||||
)
|
||||
'
|
||||
done
|
||||
|
||||
test_done
|
||||
|
||||
@@ -88,7 +88,7 @@ test_expect_success 'enable broken symlink workaround' \
|
||||
test_expect_success '"bar" is an empty file' 'test -f x/bar && ! test -s x/bar'
|
||||
test_expect_success 'get "bar" => symlink fix from svn' \
|
||||
'(cd x && git svn rebase)'
|
||||
test_expect_success '"bar" becomes a symlink' 'test -L x/bar'
|
||||
test_expect_success SYMLINKS '"bar" becomes a symlink' 'test -L x/bar'
|
||||
|
||||
|
||||
test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" y'
|
||||
|
||||
@@ -85,7 +85,7 @@ EOF
|
||||
|
||||
test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" x'
|
||||
|
||||
test_expect_success '"bar" is a symlink that points to "asdf"' '
|
||||
test_expect_success SYMLINKS '"bar" is a symlink that points to "asdf"' '
|
||||
test -L x/bar &&
|
||||
(cd x && test xasdf = x"`git cat-file blob HEAD:bar`")
|
||||
'
|
||||
@@ -94,7 +94,7 @@ test_expect_success 'get "bar" => symlink fix from svn' '
|
||||
(cd x && git svn rebase)
|
||||
'
|
||||
|
||||
test_expect_success '"bar" remains a proper symlink' '
|
||||
test_expect_success SYMLINKS '"bar" remains a proper symlink' '
|
||||
test -L x/bar &&
|
||||
(cd x && test xdoink = x"`git cat-file blob HEAD:bar`")
|
||||
'
|
||||
|
||||
@@ -225,11 +225,12 @@ test_expect_success \
|
||||
test_must_fail git cvsexportcommit -c $id
|
||||
)'
|
||||
|
||||
case "$(git config --bool core.filemode)" in
|
||||
false)
|
||||
;;
|
||||
*)
|
||||
test_expect_success \
|
||||
if ! test "$(git config --bool core.filemode)" = false
|
||||
then
|
||||
test_set_prereq FILEMODE
|
||||
fi
|
||||
|
||||
test_expect_success FILEMODE \
|
||||
'Retain execute bit' \
|
||||
'mkdir G &&
|
||||
echo executeon >G/on &&
|
||||
@@ -243,8 +244,6 @@ test_expect_success \
|
||||
test -x G/on &&
|
||||
! test -x G/off
|
||||
)'
|
||||
;;
|
||||
esac
|
||||
|
||||
test_expect_success '-w option should work with relative GIT_DIR' '
|
||||
mkdir W &&
|
||||
|
||||
@@ -246,7 +246,7 @@ test_expect_success \
|
||||
gitweb_run "p=.git;a=commitdiff"'
|
||||
test_debug 'cat gitweb.log'
|
||||
|
||||
test_expect_success \
|
||||
test_expect_success SYMLINKS \
|
||||
'commitdiff(0): file to symlink' \
|
||||
'rm renamed_file &&
|
||||
ln -s file renamed_file &&
|
||||
@@ -308,7 +308,7 @@ test_debug 'cat gitweb.log'
|
||||
# ----------------------------------------------------------------------
|
||||
# commitdiff testing (taken from t4114-apply-typechange.sh)
|
||||
|
||||
test_expect_success 'setup typechange commits' '
|
||||
test_expect_success SYMLINKS 'setup typechange commits' '
|
||||
echo "hello world" > foo &&
|
||||
echo "hi planet" > bar &&
|
||||
git update-index --add foo bar &&
|
||||
@@ -418,7 +418,12 @@ test_expect_success \
|
||||
git mv 04-rename-from 04-rename-to &&
|
||||
echo "Changed" >> 04-rename-to &&
|
||||
test_chmod +x 05-mode-change &&
|
||||
rm -f 06-file-or-symlink && ln -s 01-change 06-file-or-symlink &&
|
||||
rm -f 06-file-or-symlink &&
|
||||
if test_have_prereq SYMLINKS; then
|
||||
ln -s 01-change 06-file-or-symlink
|
||||
else
|
||||
printf %s 01-change > 06-file-or-symlink
|
||||
fi &&
|
||||
echo "Changed and have mode changed" > 07-change-mode-change &&
|
||||
test_chmod +x 07-change-mode-change &&
|
||||
git commit -a -m "Large commit" &&
|
||||
|
||||
@@ -247,6 +247,31 @@ test_chmod () {
|
||||
git update-index --add "--chmod=$@"
|
||||
}
|
||||
|
||||
# Use test_set_prereq to tell that a particular prerequisite is available.
|
||||
# The prerequisite can later be checked for in two ways:
|
||||
#
|
||||
# - Explicitly using test_have_prereq.
|
||||
#
|
||||
# - Implicitly by specifying the prerequisite tag in the calls to
|
||||
# test_expect_{success,failure,code}.
|
||||
#
|
||||
# The single parameter is the prerequisite tag (a simple word, in all
|
||||
# capital letters by convention).
|
||||
|
||||
test_set_prereq () {
|
||||
satisfied="$satisfied$1 "
|
||||
}
|
||||
satisfied=" "
|
||||
|
||||
test_have_prereq () {
|
||||
case $satisfied in
|
||||
*" $1 "*)
|
||||
: yes, have it ;;
|
||||
*)
|
||||
! : nope ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# You are not expected to call test_ok_ and test_failure_ directly, use
|
||||
# the text_expect_* functions instead.
|
||||
|
||||
@@ -293,6 +318,11 @@ test_skip () {
|
||||
to_skip=t
|
||||
esac
|
||||
done
|
||||
if test -z "$to_skip" && test -n "$prereq" &&
|
||||
! test_have_prereq "$prereq"
|
||||
then
|
||||
to_skip=t
|
||||
fi
|
||||
case "$to_skip" in
|
||||
t)
|
||||
say_color skip >&3 "skipping test: $@"
|
||||
@@ -306,8 +336,9 @@ test_skip () {
|
||||
}
|
||||
|
||||
test_expect_failure () {
|
||||
test "$#" = 3 && { prereq=$1; shift; } || prereq=
|
||||
test "$#" = 2 ||
|
||||
error "bug in the test script: not 2 parameters to test-expect-failure"
|
||||
error "bug in the test script: not 2 or 3 parameters to test-expect-failure"
|
||||
if ! test_skip "$@"
|
||||
then
|
||||
say >&3 "checking known breakage: $2"
|
||||
@@ -323,8 +354,9 @@ test_expect_failure () {
|
||||
}
|
||||
|
||||
test_expect_success () {
|
||||
test "$#" = 3 && { prereq=$1; shift; } || prereq=
|
||||
test "$#" = 2 ||
|
||||
error "bug in the test script: not 2 parameters to test-expect-success"
|
||||
error "bug in the test script: not 2 or 3 parameters to test-expect-success"
|
||||
if ! test_skip "$@"
|
||||
then
|
||||
say >&3 "expecting success: $2"
|
||||
@@ -340,8 +372,9 @@ test_expect_success () {
|
||||
}
|
||||
|
||||
test_expect_code () {
|
||||
test "$#" = 4 && { prereq=$1; shift; } || prereq=
|
||||
test "$#" = 3 ||
|
||||
error "bug in the test script: not 3 parameters to test-expect-code"
|
||||
error "bug in the test script: not 3 or 4 parameters to test-expect-code"
|
||||
if ! test_skip "$@"
|
||||
then
|
||||
say >&3 "expecting exit code $1: $3"
|
||||
@@ -365,8 +398,9 @@ test_expect_code () {
|
||||
# Usage: test_external description command arguments...
|
||||
# Example: test_external 'Perl API' perl ../path/to/test.pl
|
||||
test_external () {
|
||||
test "$#" -eq 3 ||
|
||||
error >&5 "bug in the test script: not 3 parameters to test_external"
|
||||
test "$#" = 4 && { prereq=$1; shift; } || prereq=
|
||||
test "$#" = 3 ||
|
||||
error >&5 "bug in the test script: not 3 or 4 parameters to test_external"
|
||||
descr="$1"
|
||||
shift
|
||||
if ! test_skip "$descr" "$@"
|
||||
@@ -624,10 +658,6 @@ test_create_repo "$test"
|
||||
# in subprocesses like git equals our $PWD (for pathname comparisons).
|
||||
cd -P "$test" || exit 1
|
||||
|
||||
# test for symbolic link capability
|
||||
ln -s x y 2> /dev/null && test -l y 2> /dev/null || no_symlinks=1
|
||||
rm -f y
|
||||
|
||||
this_test=${0##*/}
|
||||
this_test=${this_test%%-*}
|
||||
for skp in $GIT_SKIP_TESTS
|
||||
@@ -665,5 +695,15 @@ case $(uname -s) in
|
||||
pwd () {
|
||||
builtin pwd -W
|
||||
}
|
||||
# no POSIX permissions
|
||||
# backslashes in pathspec are converted to '/'
|
||||
;;
|
||||
*)
|
||||
test_set_prereq POSIXPERM
|
||||
test_set_prereq BSLASHPSPEC
|
||||
;;
|
||||
esac
|
||||
|
||||
# test whether the filesystem supports symbolic links
|
||||
ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
|
||||
rm -f y
|
||||
|
||||
Reference in New Issue
Block a user