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

Handle diffs containing deleted symlinks (fixes a go panic) #9

Merged
merged 2 commits into from
Jan 8, 2018
Merged

Handle diffs containing deleted symlinks (fixes a go panic) #9

merged 2 commits into from
Jan 8, 2018

Conversation

nathanleiby
Copy link
Collaborator

Previously, this regex didn't match diffs for deleted symlinks: https://github.com/waigani/diffparser/blob/master/diffparser.go#L165

This led to a panic here: https://github.com/waigani/diffparser/blob/master/diffparser.go#L167

If the Regex finds no matches, the code tried to index into an array of length 0.

Previously, this regex didn't match diffs for deleted symlinks: https://github.com/waigani/diffparser/blob/master/diffparser.go#L165

This led to an error here: https://github.com/waigani/diffparser/blob/master/diffparser.go#L167

If the Regex finds no matches, the code tried to index into an array of length 0.
@nathanleiby
Copy link
Collaborator Author

Hello @waigani and thanks for making this library! If I can be of any particular help in getting this merged, please let me know.

You should be able to verify it works by running go test locally.

@nathanleiby
Copy link
Collaborator Author

nathanleiby commented Jan 3, 2018

I noticed another case where a similar diff occurs. If you just add / remove a newline from the end of the file, it also results in a diff that's missing the first length param

Example:

diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 6b2e78d..7272c3f 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1 +1 @@
-* nathan.leiby@clever.com
+* nathan.leiby@clever.com
\ No newline at end of file

@nathanleiby
Copy link
Collaborator Author

nathanleiby commented Jan 7, 2018

Derp, I totally missed that someone else had requested basically the same change in a previous PR (closed) #6 and another (open) #4

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.

1 participant