Skip to content
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

Git Workflow: do not use just the filename, but full path in reporting #105

Merged

Conversation

david-binda
Copy link
Collaborator

Changes the runGitWorkflowForFile the way it uses the passed in path for a file, instead of just the filename, during reporting in order to fix the incorrectly reported issues in new files with same filename, but different paths.

A test covering the edge case is also included.

fixes #104

@david-binda david-binda changed the title Git Workflow: do not use just the filename, but full path Git Workflow: do not use just the filename, but full path in reporting Jan 29, 2025
@sirbrillig
Copy link
Owner

This looks amazing! Thanks for the bug fix. I just want to go over the commit history once to make sure I understand why we used the filename in this code to begin with. It seems like a very intentional decision so I want to make sure we're not breaking something.

Copy link
Owner

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like getFileNameFromPath was added in #54, specifically 14c8138 and 1039133. I can't quite tell why it was there except as a replacement for the previous use of DiffLineMap::getFileNameFromDiff() which seems to return whatever the full filename is in the diff; it's not clear to me why we needed to switch to the relative filename there.

The filename requirement seems to be added in #51 originally, and that also has tests (thanks for those!) so hopefully this won't break those optimizations either.

The only request I have, then is that we make this improvement to both the svn and the git workflows and remove getFileNameFromPath entirely since I believe this is its only use.

@sirbrillig
Copy link
Owner

@david-binda if you'd prefer, we can just merge this fix since it's an important bug and handle cleaning up the SVN version later. What do you think?

@sirbrillig
Copy link
Owner

sirbrillig commented Mar 11, 2025

Still waiting for a reply but I think I'm going to merge this anyway as it fixes a present bug.

@sirbrillig sirbrillig merged commit 4f0c7e2 into sirbrillig:trunk Mar 11, 2025
13 checks passed
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.

Incorrect output for newly added files with the same filenames, but different paths, in git workflow
2 participants