mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
ignore: fix include: rules depending on current directory (issue4759)
When reading pattern files, we just call open(path), which is relative to the current directory. Let's fix this by resolving the paths before attempting to read the file.
This commit is contained in:
parent
c9da9870f4
commit
677efb706e
@ -289,7 +289,8 @@ class match(object):
|
||||
continue
|
||||
elif kind == 'include':
|
||||
try:
|
||||
includepats = readpatternfile(pat, self._warn)
|
||||
fullpath = pathutil.join(root, pat)
|
||||
includepats = readpatternfile(fullpath, self._warn)
|
||||
for k, p, source in self._normalize(includepats, default,
|
||||
root, cwd, auditor):
|
||||
kindpats.append((k, p, source or pat))
|
||||
|
@ -186,8 +186,9 @@ Check using 'include:' in ignore file
|
||||
|
||||
Check recursive uses of 'include:'
|
||||
|
||||
$ echo "include:nestedignore" >> otherignore
|
||||
$ echo "glob:*ignore" > nestedignore
|
||||
$ echo "include:nested/ignore" >> otherignore
|
||||
$ mkdir nested
|
||||
$ echo "glob:*ignore" > nested/ignore
|
||||
$ hg status
|
||||
A dir/b.o
|
||||
|
||||
@ -199,6 +200,13 @@ Check recursive uses of 'include:'
|
||||
|
||||
$ mv goodignore otherignore
|
||||
|
||||
Check using 'include:' while in a non-root directory
|
||||
|
||||
$ cd ..
|
||||
$ hg -R ignorerepo status
|
||||
A dir/b.o
|
||||
$ cd ignorerepo
|
||||
|
||||
Check including subincludes
|
||||
|
||||
$ hg revert -q --all
|
||||
|
Loading…
Reference in New Issue
Block a user