##// END OF EJS Templates
add test-inherit-mode
Alexis S. L. Carvalho -
r6064:c608f67a default
parent child Browse files
Show More
@@ -0,0 +1,67 b''
1 #!/bin/sh
2
3 # test that new files created in .hg inherit the permissions from .hg/store
4
5 "$TESTDIR/hghave" unix-permissions || exit 80
6
7 mkdir dir
8 # just in case somebody has a strange $TMPDIR
9 chmod g-s dir
10 cd dir
11
12 cat >printmodes.py <<EOF
13 import os, sys
14
15 allnames = []
16 isdir = {}
17 for root, dirs, files in os.walk(sys.argv[1]):
18 for d in dirs:
19 name = os.path.join(root, d)
20 isdir[name] = 1
21 allnames.append(name)
22 for f in files:
23 name = os.path.join(root, f)
24 allnames.append(name)
25 allnames.sort()
26 for name in allnames:
27 suffix = name in isdir and '/' or ''
28 print '%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix)
29 EOF
30
31 umask 077
32
33 hg init repo
34 cd repo
35
36 chmod 02770 .hg/store
37
38 echo '% before commit'
39 echo '% store can be written by the group, other files cannot'
40 echo '% store is setgid'
41 python ../printmodes.py .
42
43 mkdir dir
44 touch foo dir/bar
45 hg ci -qAm 'add files'
46
47 echo
48 echo '% after commit'
49 echo '% working dir files can only be written by the owner'
50 echo '% files created in .hg can be written by the group'
51 echo '% (in particular, store/**, dirstate, branch.cache)'
52 echo '% new directories are setgid'
53 python ../printmodes.py .
54
55 umask 007
56 hg init ../push
57 echo
58 echo '% before push'
59 echo '% group can write everything'
60 python ../printmodes.py ../push
61
62 umask 077
63 hg -q push ../push
64 echo
65 echo '% after push'
66 echo '% group can still write everything'
67 python ../printmodes.py ../push
@@ -0,0 +1,54 b''
1 % before commit
2 % store can be written by the group, other files cannot
3 % store is setgid
4 00700 ./.hg/
5 00600 ./.hg/00changelog.i
6 00600 ./.hg/requires
7 02770 ./.hg/store/
8
9 % after commit
10 % working dir files can only be written by the owner
11 % files created in .hg can be written by the group
12 % (in particular, store/**, dirstate, branch.cache)
13 % new directories are setgid
14 00700 ./.hg/
15 00600 ./.hg/00changelog.i
16 00660 ./.hg/dirstate
17 00600 ./.hg/requires
18 02770 ./.hg/store/
19 00660 ./.hg/store/00changelog.i
20 00660 ./.hg/store/00manifest.i
21 02770 ./.hg/store/data/
22 02770 ./.hg/store/data/dir/
23 00660 ./.hg/store/data/dir/bar.i
24 00660 ./.hg/store/data/foo.i
25 00600 ./.hg/store/undo
26 00660 ./.hg/undo.branch
27 00660 ./.hg/undo.dirstate
28 00700 ./dir/
29 00600 ./dir/bar
30 00600 ./foo
31
32 % before push
33 % group can write everything
34 00770 ../push/.hg/
35 00660 ../push/.hg/00changelog.i
36 00660 ../push/.hg/requires
37 00770 ../push/.hg/store/
38
39 % after push
40 % group can still write everything
41 00770 ../push/.hg/
42 00660 ../push/.hg/00changelog.i
43 00660 ../push/.hg/branch.cache
44 00660 ../push/.hg/requires
45 00770 ../push/.hg/store/
46 00660 ../push/.hg/store/00changelog.i
47 00660 ../push/.hg/store/00manifest.i
48 00770 ../push/.hg/store/data/
49 00770 ../push/.hg/store/data/dir/
50 00660 ../push/.hg/store/data/dir/bar.i
51 00660 ../push/.hg/store/data/foo.i
52 00600 ../push/.hg/store/undo
53 00660 ../push/.hg/undo.branch
54 00660 ../push/.hg/undo.dirstate
General Comments 0
You need to be logged in to leave comments. Login now