Skip to content

Conversation

jamiekyle-eb
Copy link
Contributor

Resolves #92

path.relative(from, to) is weird when you have an absolute path and a relative path. By normalizing p to path.join(cwd, p) to get an absolute path it works.

I added some additional guards here just to be really safe about it:

  • If p is already an absolute path:
    • Assert that it is in cwd and return it
  • Otherwise, path.join(cwd, p)

I don't know if these cases will actually come up, but it seemed better to give a specific error message and guard it a bit more.

@sindresorhus sindresorhus changed the title Upgrade ignore package Upgrade ignore package Jun 14, 2019
@sindresorhus sindresorhus merged commit 04d51bf into sindresorhus:master Jun 14, 2019
@fisker fisker mentioned this pull request Feb 26, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update ignore package to latest version
3 participants