Show More
@@ -215,6 +215,30 b' def canonpath(root, cwd, myname):' | |||
|
215 | 215 | elif name == root: |
|
216 | 216 | return '' |
|
217 | 217 | else: |
|
218 | # Determine whether `name' is in the hierarchy at or beneath `root', | |
|
219 | # by iterating name=dirname(name) until that causes no change (can't | |
|
220 | # check name == '/', because that doesn't work on windows). For each | |
|
221 | # `name', compare dev/inode numbers. If they match, the list `rel' | |
|
222 | # holds the reversed list of components making up the relative file | |
|
223 | # name we want. | |
|
224 | root_st = os.stat(root) | |
|
225 | rel = [] | |
|
226 | while True: | |
|
227 | try: | |
|
228 | name_st = os.stat(name) | |
|
229 | except OSError: | |
|
230 | break | |
|
231 | if os.path.samestat(name_st, root_st): | |
|
232 | rel.reverse() | |
|
233 | name = os.path.join(*rel) | |
|
234 | audit_path(name) | |
|
235 | return pconvert(name) | |
|
236 | dirname, basename = os.path.split(name) | |
|
237 | rel.append(basename) | |
|
238 | if dirname == name: | |
|
239 | break | |
|
240 | name = dirname | |
|
241 | ||
|
218 | 242 | raise Abort('%s not under root' % myname) |
|
219 | 243 | |
|
220 | 244 | def matcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None): |
@@ -40,3 +40,18 b' mkfifo a.c' | |||
|
40 | 40 | # it should show a.c, dir/a.o and dir/b.o deleted |
|
41 | 41 | hg status |
|
42 | 42 | hg status a.c |
|
43 | ||
|
44 | echo '# test absolute path through symlink outside repo' | |
|
45 | cd .. | |
|
46 | p=`pwd` | |
|
47 | hg init x | |
|
48 | ln -s x y | |
|
49 | cd x | |
|
50 | touch f | |
|
51 | hg add f | |
|
52 | hg status $p/y/f | |
|
53 | ||
|
54 | echo '# try symlink outside repo to file inside' | |
|
55 | ln -s x/f ../z | |
|
56 | # this should fail | |
|
57 | hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || : |
General Comments 0
You need to be logged in to leave comments.
Login now