Skip to content

gitdiff: line 63: git file header: invalid mode line: invalid syntax #37

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

Closed
prologic opened this issue Dec 26, 2022 · 6 comments · Fixed by #38
Closed

gitdiff: line 63: git file header: invalid mode line: invalid syntax #37

prologic opened this issue Dec 26, 2022 · 6 comments · Fixed by #38

Comments

@prologic
Copy link

Looks like your library is a bit out-of-date? Line 63 for me in sample I was testing with looks like this:

new file mode 100644
@prologic
Copy link
Author

Which you actually have tests for, so now I'm confused... 🤔

@bluekeyes
Copy link
Owner

Thanks for reporting this. Is it possible to share the full patch file that caused this error? If that's not possible, how was the patch generated (e.g. was it created by git, copied from an email, created by a service like GitHub of Bitbucket, etc.)?

Right now, my guess is that this is caused by something like trailing whitespace, which might have been excluded when you copied the "bad" line for this issue.

@prologic
Copy link
Author

So... I created the patch with git format-patch and send it to myself with git send-email. I then downloaded the entire contents of the Email (using the Rainloop Web interface) as an .eml file which appears to have full email headers. I piped that to a cli tool I write using your library and ran into that error and it has since befuddled me 😅 -- I suspect you're right.

@bluekeyes
Copy link
Owner

I think it's likely that something in that process (the email stage?) is converting line endings from \n to \r\n in the whole patch and the parsing for mode lines failed on the extra \r character. That should be fixed on master if you want to test it out. That said, depending on what you are doing with the patch in your CLI you may need to fix up the line endings before parsing anyway.

@prologic
Copy link
Author

@bluekeyes Ahh awesome! I never got as far as this in debugging this! Nice one 👌 (btw, where can I discuss some other ideas with you? I have a need that I think your library could help fulfll...)

@bluekeyes
Copy link
Owner

@prologic I think creating a new issue is the best way to discuss ideas or usage of this library

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 a pull request may close this issue.

2 participants