Skip to content

merge tags are causing issues with GitPython #102

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
hyperair opened this issue Mar 14, 2013 · 2 comments
Closed

merge tags are causing issues with GitPython #102

hyperair opened this issue Mar 14, 2013 · 2 comments
Milestone

Comments

@hyperair
Copy link

Related bug report with Dulwich: https://bugs.launchpad.net/dulwich/+bug/963525

Test case:

#!/usr/bin/python

import git

repo = git.Repo.clone_from('git://github.com/puppetlabs/puppet.git', 'puppet',
                           bare=True)
repo.commit('b00f8600a3cfd37590e644da98b12800569554d2').parents

Traceback:

Traceback (most recent call last):
  File "./mergetag-testcase.py", line 7, in <module>
    repo.commit('b00f8600a3cfd37590e644da98b12800569554d2').parents
  File "/usr/lib/python2.7/dist-packages/gitdb/util.py", line 238, in __getattr__
    self._set_cache_(attr)
  File "/usr/lib/python2.7/dist-packages/git/objects/commit.py", line 132, in _set_cache_
    self._deserialize(StringIO(stream.read()))
  File "/usr/lib/python2.7/dist-packages/git/objects/commit.py", line 443, in _deserialize
    self.author.name = self.author.name.decode(self.encoding)
LookupError: unknown encoding: object a61c7851ee3f02118d9f10724e95554fa90e7d18

Basically the data stream now contains mergetag objects which GitPython doesn't know how to parse:

$ git cat-file -p b00f8600a3cfd37590e644da98b12800569554d2
tree 94f6f055e0d6c5eaf8f3e2509a803abcfe5a5f81
parent 4173839dd274202bb74a3dd59e6d66e4e52e40e5
parent a61c7851ee3f02118d9f10724e95554fa90e7d18
author Nick Lewis <[email protected]> 1330024544 -0800
committer Nick Lewis <[email protected]> 1330024544 -0800
mergetag object a61c7851ee3f02118d9f10724e95554fa90e7d18
 type commit
 tag 2.6.14
 tagger Matthaus Litteken <[email protected]> 1329867278 -0800

 2.6.14
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (Darwin)

 iQIcBAABAgAGBQJPRCoOAAoJEBBUt6JL1uwwTrIP/39zSu0GPC+R31kt7HLdvbEG
 1/8yH3Ss9ihapDlOiMRL5nUL2NoRKohfIfFqQLSDtwuSgIaoH26tBmKnbaje7VZ6
 0h94seFKI228y3yu4H2XRKkucEF0gkqNmKJjbZ6kX3g4byS8WSm+ZgoS5LajdEg0
 mEQWkhGgklN6j1EbEbmKaS1dZF9zW9GYZ8sDux08UhaJkDayJGDmlQ2EbV4pyn1q
 2RDVUr+RMNIFjCzf7oiKvrUt80dPIHVl6q9xJHc3nR2MDEopEMq0L+H75ZFDAqoA
 vnTSIggb2FIgtHWBmSTZknl/vEH3PuGNdm8H3PFYMRR1XSjOJLlyQuV/BIPJcdo9
 HflFhTsPK49GLAeEMf0dWQZSgnDyJfQ8NGCfCvmu8M28QkYdanWGGPxFVgaT1u8I
 o5FBi+/ik/FnzzP0ThM4W2bvWHxm8i6KQwjOiC/2aQmYZQb0aEDpnGaoITyoJGP1
 qnUALt/pwvKNng/74VBNbvdJgI1xjBte52iXF70AySCzr5bHn1FoBroaS1NBuUCW
 Tctayzj1IsF7bSikO4vv0K+594RI9hhTQzMdnCuP3tjotGcqRuFJfYren1sb9X0C
 Dq3e/F83NjPfghE0tzgk8rAwNjdkLPuQMWXr/arp8Qa7qB6UITLcS/Pd48+1xFmd
 xZ5r0TSjPVxVx992dKWV
 =v8sR
 -----END PGP SIGNATURE-----

Merge tag '2.6.14' into 2.6.x

Somewhat interesting (for parsing) is that the "blank" lines in the mergetag block are actually prefixed with one space, so a simple fix (without adding mergetag support) would be to skip over that block until a blank line is found.

@hyperair
Copy link
Author

From the comments in the Dulwich bug, I think there can be more than one mergetag present in the stream.

johnsca pushed a commit to johnsca/GitPython that referenced this issue Apr 11, 2013
@Byron Byron added this to the v0.3.2 milestone Nov 19, 2014
@Byron
Copy link
Member

Byron commented Nov 19, 2014

Merge-tags as well as PGP signature support was added to the latest version on pypi. Please comment here if this doesn't fix the issue for you.

@Byron Byron closed this as completed Nov 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants