##// END OF EJS Templates
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering -
r2115:fd77b7ee default
parent child Browse files
Show More
@@ -215,6 +215,30 b' def canonpath(root, cwd, myname):'
215 elif name == root:
215 elif name == root:
216 return ''
216 return ''
217 else:
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 raise Abort('%s not under root' % myname)
242 raise Abort('%s not under root' % myname)
219
243
220 def matcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None):
244 def matcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None):
@@ -9,3 +9,7 b' adding dir/b.o'
9 ? .hgignore
9 ? .hgignore
10 a.c: unsupported file type (type is fifo)
10 a.c: unsupported file type (type is fifo)
11 ! a.c
11 ! a.c
12 # test absolute path through symlink outside repo
13 A f
14 # try symlink outside repo to file inside
15 abort: ../z not under root
General Comments 0
You need to be logged in to leave comments. Login now