Skip to content

Fix GPG signed commits breaks parsing of commit messages #109

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

Merged
merged 1 commit into from
May 10, 2016
Merged

Fix GPG signed commits breaks parsing of commit messages #109

merged 1 commit into from
May 10, 2016

Conversation

stojg
Copy link

@stojg stojg commented Apr 22, 2016

If commits are signed gpg they will break the parsing of the log message since it's expecting two newlines after the commiter date where in the case of a GPG signature is added:

Example commit:

commit e1a83f16ed61ae3807e5652c7ef894692c813513
tree 90908bdccbb0b9c42fdb6225d5aa47d7c66c3d22
parent 583811146f79f1bf6e167d54b276e21553512d1a
author Stig Lindqvist <[email protected]> 1461274840 +1200
committer Stig Lindqvist <[email protected]> 1461274840 +1200
gpgsig -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1

 iQEcBAABAgAGBQJXGUjZAAoJEF7kfUZDyWQIaUkIAMYsSKA2C3XOQ2x0Ig3zOF5Y
 DV1YlSWa2ILy/V49U55CWMP/Atbr1bKpREMI9y1T9tBwsMV1gtqYk+JwqyCntTjD
 iaFexti++AZv47YrQa4aBtW18hRJp/BFrLjhkGnydHLvK1QJ2EAhIuqwRYiMHS8m
 mX3ChT1Quk5yZFumpPduGqwdNVWDxCssNMA6MKjn/gBWV1PUbsZWN2a9I54v7xfR
 ujKvzqwsnkKhOC4+0sQM25sw0AHj2/pqhAmB7tW+mjcUBY911ym7f1SvAMdrdMHm
 S5AJ0RkrntFqUA1Ydc6om+zUCSB8ztuNbD4JK5YrqukEy2ooyehWs8qc1NNLVLQ=
 =4KdG
 -----END PGP SIGNATURE-----

    signed commit

This PR is the quick solution by consuming the GPGSig (if it exists) and then throw it away.

I added a test for this, but had to use my own fork to create a signed commit, so the tests will obviously fail unless the AbstractTest Repo is changed to const REPOSITORY_URL = 'http://github.com/stojg/foobar.git';

This should fix #108

@stojg
Copy link
Author

stojg commented Apr 28, 2016

Anything else I can do to move this forward?

@sminnee
Copy link

sminnee commented Apr 28, 2016

Looks like the tests are breaking, @stojg?

@stojg stojg mentioned this pull request Apr 28, 2016
@stojg
Copy link
Author

stojg commented Apr 28, 2016

Created a PR for the signed commit in the foobar repo gitonomy/foobar#1

@lyrixx
Copy link
Member

lyrixx commented Apr 29, 2016

I just merged your PR thanks.

@dhensby
Copy link

dhensby commented May 5, 2016

Bump :)

@stojg stojg closed this May 5, 2016
@stojg stojg reopened this May 5, 2016
@stojg
Copy link
Author

stojg commented May 5, 2016

Closed and reopened to trigger the travis tests

@dhensby
Copy link

dhensby commented May 5, 2016

Green ticks, yay.

:shipit:

@mateusz
Copy link

mateusz commented May 5, 2016

yay :shipit:

@tractorcow
Copy link

@tractorcow
Copy link

@lyrixx would you please be able to review this, now that the tests are passing?

@lyrixx
Copy link
Member

lyrixx commented May 10, 2016

Good catch, thanks @stojg.

@lyrixx lyrixx merged commit ab21ff6 into gitonomy:master May 10, 2016
lyrixx added a commit that referenced this pull request May 10, 2016
…stojg)

This PR was merged into the 1.0-dev branch.

Discussion
----------

Fix GPG signed commits breaks parsing of commit messages

If commits are [signed gpg](https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work) they will break the parsing of the log message since it's expecting two newlines after the commiter date where in the case of a GPG signature is added:

Example commit:
```
commit e1a83f16ed61ae3807e5652c7ef894692c813513
tree 90908bdccbb0b9c42fdb6225d5aa47d7c66c3d22
parent 583811146f79f1bf6e167d54b276e21553512d1a
author Stig Lindqvist <[email protected]> 1461274840 +1200
committer Stig Lindqvist <[email protected]> 1461274840 +1200
gpgsig -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1

 iQEcBAABAgAGBQJXGUjZAAoJEF7kfUZDyWQIaUkIAMYsSKA2C3XOQ2x0Ig3zOF5Y
 DV1YlSWa2ILy/V49U55CWMP/Atbr1bKpREMI9y1T9tBwsMV1gtqYk+JwqyCntTjD
 iaFexti++AZv47YrQa4aBtW18hRJp/BFrLjhkGnydHLvK1QJ2EAhIuqwRYiMHS8m
 mX3ChT1Quk5yZFumpPduGqwdNVWDxCssNMA6MKjn/gBWV1PUbsZWN2a9I54v7xfR
 ujKvzqwsnkKhOC4+0sQM25sw0AHj2/pqhAmB7tW+mjcUBY911ym7f1SvAMdrdMHm
 S5AJ0RkrntFqUA1Ydc6om+zUCSB8ztuNbD4JK5YrqukEy2ooyehWs8qc1NNLVLQ=
 =4KdG
 -----END PGP SIGNATURE-----

    signed commit

```

This PR is the quick solution by consuming the GPGSig (if it exists) and then throw it away.

I added a test for this, but had to use my own [fork to create a signed commit](https://github.com/stojg/foobar/commit/e1a83f16ed61ae3807e5652c7ef894692c813513), so the tests will obviously fail unless the AbstractTest Repo is changed to `const REPOSITORY_URL = 'http://github.com/stojg/foobar.git';`

This should fix #108

Commits
-------

ab21ff6 Fix GPG signed commits breaks parsing of commit messages
@lyrixx
Copy link
Member

lyrixx commented May 10, 2016

Released as v1.0.1

@tractorcow
Copy link

Yay thanks @lyrixx !

@stojg
Copy link
Author

stojg commented May 10, 2016

Excellent, thanks a lot.

Unfortunately I missed another case where signed commits break gitlib. Sorry for not finding it earlier :/ #110

I've tried to search for other parser that might be broken, but couldn't find any other that actually parses the commit message.

lyrixx added a commit that referenced this pull request May 11, 2016
…essage (stojg)

This PR was merged into the 1.0-dev branch.

Discussion
----------

Fix GPG signed commits will break on reading full commit message

Ensure that we can get the full message when the commit has been GPG signed

Follow up on #109 that only deals with the "log" part, this ensure that we can also return the message.

Commits
-------

02de6db Fix GPG signed commits will break on reading full commit message
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.

Error parsing signed git commits
6 participants