-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Call ignoreFile.IsIgnored with absolute path. #2656
Conversation
fullPath | ||
|
||
ignoreFile.IsIgnored path | ||
ignoreFile.IsIgnored fullPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Smaug123 I believe the problem of using a relative path here is the following:
In loadIgnoreList
we process the path with
fantomas/src/Fantomas/IgnoreFile.fs
Lines 54 to 58 in 47c6ac6
let relativePath = | |
fs | |
.Path | |
.GetRelativePath(fs.Directory.GetParent(ignoreFilePath).FullName, path) | |
.Replace("\\", "/") |
Looking at the docs, they mention GetFullPath
is invoked before calculating the difference.
In the case of the cli tool
, the relative will be resolved with the pwd
because that is where we assume the ignore file
lives. For the daemon, on the other hand, the pwd
could be something really random and thus the difference is calculated wrongly.
Does this make sense to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sigh, yeah, that does make sense. But might it be better to only pass fully-qualified paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But might it be better to only pass fully-qualified paths?
Something like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems pretty plausible to me, although I can't say I am 100% confident.
Thanks @Smaug123, I think this will be fine to try out. |
Yep, sounds sane to me! |
I discovered that ignored files can potentially be formatted by
Fantomas.Client
.Steps to reproduce:
The code will read
1
which meansFormatted
, you should receive4
(Ignored
) instead.I believe I found a fix for this problem but I would like a review from @Smaug123 to be sure.