Skip tests that fail if the executable bit is not handled by the filesystem

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
This commit is contained in:
Johannes Sixt 2009-02-27 22:20:57 +01:00
Родитель 56e78bfb29
Коммит 872f349e7b
5 изменённых файлов: 42 добавлений и 20 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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"'

Просмотреть файл

@ -4,6 +4,13 @@ test_description='applying patch with mode bits'
. ./test-lib.sh
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 &&
git add file &&
@ -16,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 &&
@ -32,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 &&
@ -40,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"

Просмотреть файл

@ -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,6 +21,10 @@ test_expect_success 'mode change in one branch: keep changed version' '
git commit -m b1 &&
git checkout a1 &&
git merge-recursive master -- a1 b1 &&
git ls-files -s file1 | grep ^100755
'
test_expect_success FILEMODE 'verify executable bit on file' '
test -x file1
'
@ -41,6 +50,10 @@ test_expect_success 'mode change in both branches: expect conflict' '
echo "100644 $H 3 file2"
) >expect &&
test_cmp actual expect &&
git ls-files -s file2 | grep ^100755
'
test_expect_success FILEMODE 'verify executable bit on file' '
test -x file2
'

Просмотреть файл

@ -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 &&