Skip to content

Commit 060fe57

Browse files
Ramsay Jonesgitster
authored andcommitted
Fix a test failure (t9500-*.sh) on cygwin
On filesystems where it is appropriate to set core.filemode to false, test 29 ("commitdiff(0): mode change") fails when git-commit does not notice a file (execute) permission change. A fix requires noting the new file execute permission in the index with a "git update-index --chmod=+x", prior to the commit. Add a function (note_chmod) which implements this idea, and insert a call in each test that modifies the x permission. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 05cc2ff commit 060fe57

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

t/t9500-gitweb-standalone-no-errors.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ gitweb_run () {
5858
# gitweb.log is left for debugging
5959
}
6060

61+
safe_chmod () {
62+
chmod "$1" "$2" &&
63+
if [ "$(git config --get core.filemode)" = false ]
64+
then
65+
git update-index --chmod="$1" "$2"
66+
fi
67+
}
68+
6169
. ./test-lib.sh
6270

6371
perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || {
@@ -229,7 +237,7 @@ test_debug 'cat gitweb.log'
229237

230238
test_expect_success \
231239
'commitdiff(0): mode change' \
232-
'chmod a+x new_file &&
240+
'safe_chmod +x new_file &&
233241
git commit -a -m "Mode changed." &&
234242
gitweb_run "p=.git;a=commitdiff"'
235243
test_debug 'cat gitweb.log'
@@ -268,7 +276,7 @@ test_debug 'cat gitweb.log'
268276
test_expect_success \
269277
'commitdiff(0): mode change and modified' \
270278
'echo "New line" >> file2 &&
271-
chmod a+x file2 &&
279+
safe_chmod +x file2 &&
272280
git commit -a -m "Mode change and modification." &&
273281
gitweb_run "p=.git;a=commitdiff"'
274282
test_debug 'cat gitweb.log'
@@ -295,7 +303,7 @@ test_expect_success \
295303
'commitdiff(0): renamed, mode change and modified' \
296304
'git mv file3 file2 &&
297305
echo "Propter nomen suum." >> file2 &&
298-
chmod a+x file2 &&
306+
safe_chmod +x file2 &&
299307
git commit -a -m "File rename, mode change and modification." &&
300308
gitweb_run "p=.git;a=commitdiff"'
301309
test_debug 'cat gitweb.log'
@@ -412,10 +420,10 @@ test_expect_success \
412420
git add 03-new &&
413421
git mv 04-rename-from 04-rename-to &&
414422
echo "Changed" >> 04-rename-to &&
415-
chmod a+x 05-mode-change &&
423+
safe_chmod +x 05-mode-change &&
416424
rm -f 06-file-or-symlink && ln -s 01-change 06-file-or-symlink &&
417425
echo "Changed and have mode changed" > 07-change-mode-change &&
418-
chmod a+x 07-change-mode-change &&
426+
safe_chmod +x 07-change-mode-change &&
419427
git commit -a -m "Large commit" &&
420428
git checkout master'
421429

0 commit comments

Comments
 (0)