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
Unclear parsing of skip worktree #11011
Unclear parsing of skip worktree #11011
Conversation
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.
Some approval tests fail. (Note that Igor has a conflicting PR if they need to be adapted.)
#10993 is merged now 🎉 |
Parse of 'S' was done by a git-status parser not related to skip-worktree or assume-unchanged status.
6671c0a
to
18b2267
Compare
UnitTests/GitCommands.Tests/Git/GetAllChangedFilesOutputParserTest.cs
Outdated
Show resolved
Hide resolved
UnitTests/GitCommands.Tests/Git/GetAllChangedFilesOutputParserTest.cs
Outdated
Show resolved
Hide resolved
if (gitItemStatus.IsSkipWorktree) | ||
const char SkippedStatus = 'S'; | ||
const char SkippedStatusAssumeUnchanged = 's'; | ||
if (statusCharacter is not SkippedStatus or SkippedStatusAssumeUnchanged) |
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.
Hi, sorry for commenting on a closed PR but I just noticed that this condition does not look correct.
I assume the intention is to continue if statusCharacter is not one of 'S' or 's'? If so, then the condition should be:
statusCharacter is not SkippedStatus and not SkippedStatusAssumeUnchanged
As it is now, the loop will continue if statusCharacter is 's'.
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.
Parens missing?
if (statusCharacter is not SkippedStatus or SkippedStatusAssumeUnchanged) | |
if (statusCharacter is not (SkippedStatus or SkippedStatusAssumeUnchanged)) |
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.
Yes, parens should be added
But it only affects files that are both assumed unchanged and skip worktree (is that possible?)
Should be changed
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.
Actually, it is intentional. AssumeUnchanged are already added to the filelist.
There should be a comment though
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.
Interesting, I didn't know you could use or in that way.
Proposed changes
Parse of 'S' was done by a git-status parser not
related to skip-worktree or assume-unchanged status.
No functionality changed.
(Well a file can be both assume-unchanged and skip-worktree simultaneously now, I do not think that is possible in Git.)
Test methodology
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.