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>
Ramsay Jones committed
Sep 11, 2007 at 19:16 UTC
060fe5718455828b2ce5721d26be6399d782e415
1 file changed
+13
-5
t/t9500-gitweb-standalone-no-errors.sh
+13
-5
@@ -58,6 +58,14 @@ gitweb_run () {
58
# gitweb.log is left for debugging
59
}
60
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
+
69
. ./test-lib.sh
70
71
perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || {
@@ -229,7 +237,7 @@ test_debug 'cat gitweb.log'
237
238
test_expect_success \
239
'commitdiff(0): mode change' \
232
- 'chmod a+x new_file &&
240
+ 'safe_chmod +x new_file &&
241
git commit -a -m "Mode changed." &&
242
gitweb_run "p=.git;a=commitdiff"'
243
test_debug 'cat gitweb.log'
@@ -268,7 +276,7 @@ test_debug 'cat gitweb.log'
276
test_expect_success \
277
'commitdiff(0): mode change and modified' \
278
'echo "New line" >> file2 &&
271
- chmod a+x file2 &&
279
+ safe_chmod +x file2 &&
280
git commit -a -m "Mode change and modification." &&
281
gitweb_run "p=.git;a=commitdiff"'
282
test_debug 'cat gitweb.log'
@@ -295,7 +303,7 @@ test_expect_success \
303
'commitdiff(0): renamed, mode change and modified' \
304
'git mv file3 file2 &&
305
echo "Propter nomen suum." >> file2 &&
298
- chmod a+x file2 &&
306
+ safe_chmod +x file2 &&
307
git commit -a -m "File rename, mode change and modification." &&
308
gitweb_run "p=.git;a=commitdiff"'
309
test_debug 'cat gitweb.log'
@@ -412,10 +420,10 @@ test_expect_success \
420
git add 03-new &&
421
git mv 04-rename-from 04-rename-to &&
422
echo "Changed" >> 04-rename-to &&
415
- chmod a+x 05-mode-change &&
423
+ safe_chmod +x 05-mode-change &&
424
rm -f 06-file-or-symlink && ln -s 01-change 06-file-or-symlink &&
425
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 &&
427
git commit -a -m "Large commit" &&
428
git checkout master'
429