ValueError raised on symlinks that point to a different path
I have a file that is a symbolic link to another location, e.g., /one/two/three -> /four/five/six. When using parse_gitignore on the symlink path (/one/two/three) it throws a ValueError:
raise ValueError("{!r} is not in the subpath of {!r}"
I believe it's caused by this line:
rel_path = str(Path(abs_path).resolve().relative_to(self.base_path))
According to the Path() documentation, resolve() will follow symlinks and remove "..". Was this intentional behavior to resolve symlinks? If so, some additional logic may be needed to catch this situation.
I'll be happy to accept a PR that fixes this in a standard-compliant way :-)
change resolve() to absolute() I believe would solve the problem. But I feel absolute() is not officially supported as I cannot find it in the latest doc of pathlib.