git_diff
git_diff copied to clipboard
Fixing parsing a diff when a file is added w/o content
Hi there! I was trying to use the GitDiff library when I came across this bug-- when an empty file is added w/o any content* the patch doesn't have from and to fields with the expected values.
Not sure if including file_a and file_b on the headers is the best solution here but it's the one I could find :)
Please let me know if this works out.
Also-- I noticed some files are not mix format-compliant**. Would be happy to fix that as well (maybe on the same PR?)
Best! Bruno
*like this:
touch file.txt
git add file.txt
git commit -m "adding empty file"
** try:
mix format --check-formatted lib/git_diff.ex
** (Mix) mix format failed due to --check-formatted.
The following files are not formatted:
* lib/git_diff.ex