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

Fix incorrect file name on new or deleted empty files #226

Merged
merged 2 commits into from
Jan 27, 2025

Conversation

Patrick-Beuks
Copy link
Contributor

@Patrick-Beuks Patrick-Beuks commented Jan 4, 2025

The diff parser incorrectly parsed the below two diff patches

New file:

diff --git a/test b/test
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391

Deleted file:

diff --git a/test b/test
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000

As the diff file would incorrectly leave the newName/oldName in the diff fille. Breaking the isCreation(), isDeletion() and related functions as it would still contain a file name.

This PR fixes this by setting the file name to /dev/null when it is a new/deleted file.

Copy link
Member

@lyrixx lyrixx left a comment

Choose a reason for hiding this comment

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

Thanks

@lyrixx lyrixx merged commit 16214e3 into gitonomy:main Jan 27, 2025
6 checks passed
@Patrick-Beuks Patrick-Beuks deleted the fix-diff-empty-file branch January 29, 2025 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants