Skip to content

Commit

Permalink
Skip tests that fail if the executable bit is not handled by the file…
Browse files Browse the repository at this point in the history
…system

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
  • Loading branch information
Johannes Sixt committed Mar 22, 2009
1 parent 56e78bf commit 872f349
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 20 deletions.
9 changes: 5 additions & 4 deletions t/t3701-add-interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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 &&
Expand All @@ -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
8 changes: 5 additions & 3 deletions t/t4102-apply-rename.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"'
Expand Down
19 changes: 13 additions & 6 deletions t/t4129-apply-samemode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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 &&
Expand All @@ -32,28 +39,28 @@ 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 &&
git apply --cached patch-0.txt &&
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"
Expand Down
13 changes: 13 additions & 0 deletions t/t6031-merge-recursive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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
'

Expand All @@ -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
'

Expand Down
13 changes: 6 additions & 7 deletions t/t9200-git-cvsexportcommit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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 &&
Expand Down

0 comments on commit 872f349

Please sign in to comment.