[PATCH] Fix a test failure (t9500-*.sh) on cygwin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>
---
Hi Junio,

When updating to v1.5.3 from the tar-ball recently, I had this test
failure. I'm not sure if this is the best way to fix this, but it
works for me. (Note: I haven't pulled this over to my Linux partition to
test it there yet, but I don't anticipate a problem ...)

<off-topic>
"make test" on cygwin takes:              30 min. 53sec.
"make test" on Linux takes:                3 min. 16sec.
"NO_SVN_TESTS=1 make test" on Linux takes: 1 min. 48sec.
(Laptop: Core Duo T2050 @ 1.6GHz, 1GB RAM)
I knew cygwin was a little slower than Linux, but ... ;-)
<off-topic/>

ATB,

Ramsay Jones

 t/t9500-gitweb-standalone-no-errors.sh |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index fa32598..e9456b9 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -58,6 +58,14 @@ gitweb_run () {
 	# gitweb.log is left for debugging
 }
 
+note_chmod () {
+	if [ "$(git config --get core.filemode)" = false ]
+	then
+		git update-index --chmod=$1 $2
+	fi
+	return 0
+}
+
 . ./test-lib.sh
 
 perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || {
@@ -230,6 +238,7 @@ test_debug 'cat gitweb.log'
 test_expect_success \
 	'commitdiff(0): mode change' \
 	'chmod a+x new_file &&
+	 note_chmod +x new_file &&
 	 git commit -a -m "Mode changed." &&
 	 gitweb_run "p=.git;a=commitdiff"'
 test_debug 'cat gitweb.log'
@@ -269,6 +278,7 @@ test_expect_success \
 	'commitdiff(0): mode change and modified' \
 	'echo "New line" >> file2 &&
 	 chmod a+x file2 &&
+	 note_chmod +x file2 &&
 	 git commit -a -m "Mode change and modification." &&
 	 gitweb_run "p=.git;a=commitdiff"'
 test_debug 'cat gitweb.log'
@@ -296,6 +306,7 @@ test_expect_success \
 	'git mv file3 file2 &&
 	 echo "Propter nomen suum." >> file2 &&
 	 chmod a+x file2 &&
+	 note_chmod +x file2 &&
 	 git commit -a -m "File rename, mode change and modification." &&
 	 gitweb_run "p=.git;a=commitdiff"'
 test_debug 'cat gitweb.log'
@@ -413,9 +424,11 @@ test_expect_success \
 	 git mv 04-rename-from 04-rename-to &&
 	 echo "Changed" >> 04-rename-to &&
 	 chmod a+x 05-mode-change &&
+	 note_chmod +x 05-mode-change &&
 	 rm -f 06-file-or-symlink && ln -s 01-change 06-file-or-symlink &&
 	 echo "Changed and have mode changed" > 07-change-mode-change	&&
 	 chmod a+x 07-change-mode-change &&
+	 note_chmod +x 07-change-mode-change &&
 	 git commit -a -m "Large commit" &&
 	 git checkout master'
 
-- 
1.5.3


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux