Debian Codegraph @

tests/test-permissions.t

raw
1 #require unix-permissions no-root
2
3 #testcases dirstate-v1 dirstate-v2
4
5 #if dirstate-v2
6 $ cat >> $HGRCPATH << EOF
7 > [format]
8 > use-dirstate-v2=1
9 > [storage]
10 > dirstate-v2.slow-path=allow
11 > EOF
12 #endif
13
14 $ hg init t
15 $ cd t
16
17 $ echo foo > a
18 $ hg add a
19
20 $ hg commit -m "1"
21
22 $ hg verify -q
23
24 $ chmod -r .hg/store/data/a.i
25
26 $ hg verify -q
27 abort: $EACCES$: '$TESTTMP/t/.hg/store/data/a.i'
28 [255]
29
30 $ chmod +r .hg/store/data/a.i
31
32 $ hg verify -q
33
34 $ chmod -w .hg/store/data/a.i
35
36 $ echo barber > a
37 #if rust
38 $ hg commit -m "2"
39 abort: abort: when writing $TESTTMP/t/.hg/store/data/a.i: $EACCES$
40 [50]
41 #else
42 $ hg commit -m "2"
43 trouble committing a!
44 abort: $EACCES$: '$TESTTMP/t/.hg/store/data/a.i'
45 [255]
46 #endif
47
48 $ chmod -w .
49
50 $ hg diff --nodates
51 diff -r 2a18120dc1c9 a
52 --- a/a
53 +++ b/a
54 @@ -1,1 +1,1 @@
55 -foo
56 +barber
57
58 $ chmod +w .
59
60 $ chmod +w .hg/store/data/a.i
61 $ mkdir dir
62 $ touch dir/a
63 $ hg status
64 M a
65 ? dir/a
66 $ chmod -rx dir
67
68 #if no-fsmonitor
69
70 (fsmonitor makes "hg status" avoid accessing to "dir")
71
72 $ hg status
73 dir: $EACCES$* (glob)
74 M a
75
76 #endif
77
78 Reenable perm to allow deletion:
79
80 $ chmod +rx dir
81
82 $ cd ..