##// END OF EJS Templates
tests: show symlink traversal across subrepo mount point (SEC)...
Yuya Nishihara -
r34984:80d7dbda stable
parent child Browse files
Show More
@@ -0,0 +1,114 b''
1 Test illegal name
2 -----------------
3
4 on commit:
5
6 $ hg init hgname
7 $ cd hgname
8 $ mkdir sub
9 $ hg init sub/.hg
10 $ echo 'sub/.hg = sub/.hg' >> .hgsub
11 $ hg ci -qAm 'add subrepo "sub/.hg"'
12 abort: path 'sub/.hg' is inside nested repo 'sub'
13 [255]
14
15 prepare tampered repo (including the commit above):
16
17 $ hg import --bypass -qm 'add subrepo "sub/.hg"' - <<'EOF'
18 > diff --git a/.hgsub b/.hgsub
19 > new file mode 100644
20 > --- /dev/null
21 > +++ b/.hgsub
22 > @@ -0,0 +1,1 @@
23 > +sub/.hg = sub/.hg
24 > diff --git a/.hgsubstate b/.hgsubstate
25 > new file mode 100644
26 > --- /dev/null
27 > +++ b/.hgsubstate
28 > @@ -0,0 +1,1 @@
29 > +0000000000000000000000000000000000000000 sub/.hg
30 > EOF
31 $ cd ..
32
33 on clone (and update):
34
35 $ hg clone -q hgname hgname2
36 abort: path 'sub/.hg' is inside nested repo 'sub'
37 [255]
38
39 Test direct symlink traversal
40 -----------------------------
41
42 #if symlink
43
44 on commit:
45
46 $ mkdir hgsymdir
47 $ hg init hgsymdir/root
48 $ cd hgsymdir/root
49 $ ln -s ../out
50 $ hg ci -qAm 'add symlink "out"'
51 $ hg init ../out
52 $ echo 'out = out' >> .hgsub
53 BROKEN: should fail
54 $ hg ci -qAm 'add subrepo "out"'
55 $ cd ../..
56
57 on clone (and update):
58
59 $ mkdir hgsymdir2
60 BROKEN: should fail to update
61 $ hg clone -q hgsymdir/root hgsymdir2/root
62 $ ls hgsymdir2
63 out
64 root
65
66 #endif
67
68 Test indirect symlink traversal
69 -------------------------------
70
71 #if symlink
72
73 on commit:
74
75 $ mkdir hgsymin
76 $ hg init hgsymin/root
77 $ cd hgsymin/root
78 $ ln -s ../out
79 $ hg ci -qAm 'add symlink "out"'
80 $ mkdir ../out
81 $ hg init ../out/sub
82 $ echo 'out/sub = out/sub' >> .hgsub
83 $ hg ci -qAm 'add subrepo "out/sub"'
84 abort: path 'out/sub' traverses symbolic link 'out'
85 [255]
86
87 prepare tampered repo (including the commit above):
88
89 $ hg import --bypass -qm 'add subrepo "out/sub"' - <<'EOF'
90 > diff --git a/.hgsub b/.hgsub
91 > new file mode 100644
92 > --- /dev/null
93 > +++ b/.hgsub
94 > @@ -0,0 +1,1 @@
95 > +out/sub = out/sub
96 > diff --git a/.hgsubstate b/.hgsubstate
97 > new file mode 100644
98 > --- /dev/null
99 > +++ b/.hgsubstate
100 > @@ -0,0 +1,1 @@
101 > +0000000000000000000000000000000000000000 out/sub
102 > EOF
103 $ cd ../..
104
105 on clone (and update):
106
107 $ mkdir hgsymin2
108 $ hg clone -q hgsymin/root hgsymin2/root
109 abort: path 'out/sub' traverses symbolic link 'out'
110 [255]
111 $ ls hgsymin2
112 root
113
114 #endif
General Comments 0
You need to be logged in to leave comments. Login now