changeset 6113:8ca25589e960

try to fix test-inherit-mode on HFS+ HFS+ doesn't like setgid directories, so avoid them in most of the test and do a quick check that doesn't change the output when everything's OK.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 15 Feb 2008 10:51:35 -0200
parents 5ffa962783c4
children ee83510fe567
files tests/test-inherit-mode tests/test-inherit-mode.out
diffstat 2 files changed, 27 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-inherit-mode	Fri Feb 15 10:38:37 2008 -0200
+++ b/tests/test-inherit-mode	Fri Feb 15 10:51:35 2008 -0200
@@ -28,13 +28,18 @@
     print '%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix)
 EOF
 
+cat >mode.py <<EOF
+import sys
+import os
+print '%05o' % os.lstat(sys.argv[1]).st_mode
+EOF
+
 umask 077
 
 hg init repo
 cd repo
 
 chmod 0770 .hg/store
-chmod g+s .hg/store
 
 echo '% before commit'
 echo '% store can be written by the group, other files cannot'
@@ -66,3 +71,20 @@
 echo '% after push'
 echo '% group can still write everything'
 python ../printmodes.py ../push
+
+# Test that we don't lose the setgid bit when we call chmod.
+# Not all systems support setgid directories (e.g. HFS+), so
+# just check that directories have the same mode.
+cd ..
+hg init setgid
+cd setgid
+chmod g+s .hg/store 2> /dev/null
+mkdir dir
+touch dir/file
+hg ci -qAm 'add dir/file'
+storemode=`python ../mode.py .hg/store`
+dirmode=`python ../mode.py .hg/store/data/dir`
+if [ "$storemode" != "$dirmode" ]; then
+    echo "$storemode != $dirmode"
+fi
+
--- a/tests/test-inherit-mode.out	Fri Feb 15 10:38:37 2008 -0200
+++ b/tests/test-inherit-mode.out	Fri Feb 15 10:51:35 2008 -0200
@@ -4,7 +4,7 @@
 00700 ./.hg/
 00600 ./.hg/00changelog.i
 00600 ./.hg/requires
-02770 ./.hg/store/
+00770 ./.hg/store/
 
 % after commit
 % working dir files can only be written by the owner
@@ -15,11 +15,11 @@
 00600 ./.hg/00changelog.i
 00660 ./.hg/dirstate
 00600 ./.hg/requires
-02770 ./.hg/store/
+00770 ./.hg/store/
 00660 ./.hg/store/00changelog.i
 00660 ./.hg/store/00manifest.i
-02770 ./.hg/store/data/
-02770 ./.hg/store/data/dir/
+00770 ./.hg/store/data/
+00770 ./.hg/store/data/dir/
 00660 ./.hg/store/data/dir/bar.i
 00660 ./.hg/store/data/foo.i
 00660 ./.hg/store/undo