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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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.

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.

1 participant