Allow path relative-to to use parent directory symbols#14055
Allow path relative-to to use parent directory symbols#14055uek-1 wants to merge 7 commits intonushell:mainfrom
Conversation
|
Hi, thank you for your contribution! |
|
I added a single test example that targets this feature, should I add more? |
|
Thank you for your contribution! After looking into the pr, and relative issue. I think it's better to make it as a opt-in flag. Can you please add a flag for the new behavior? I think > 'a/b/c' | path relative-to 'a/d/e' # still raise error
> 'a/b/c' | path relative-to 'a/d/e' --walkup # returns ../../b/c |
|
@WindSoilder is there a specific concern why Python locks that behind a kwarg? Are there situations where it is problematic in certain ways or was it just added on pythons side to preserve backwards-compatibiliity? |
|
After looking into relative pr: python/cpython#118780 |
|
It was added in python/cpython#19813 to satisfy python/cpython#84538 which requested it to be hidden behind a switch. The behavioral difference was whether symlinks are resolved in the process. Haven't thought through how that may affect us? With the current impl there is no attempt at resolving links or hitting the file system. It just assumes clean Unix paths (do we need to consider Windows specialties here?) |
|
Some other thoughts in neovim/neovim#31790 (comment) |
Description
Addresses #13969. Allows
path relative-toto generate relative paths that use the parent directory..within them. Also changes the error type to be slightly more informative than the previous one.User-Facing Changes
Tests + Formatting
Added test example:
'a/b/c' | path relative-to 'a/d/e'