gitpython-developers/GitPython — pull request #57 by sugi (2012-05-06 05:39:08+00:00)
Title: GPG signature support on commit object.

Current version fails if any commit object has GPG signeture.

It works by just deleting lines from 433 to 440 of git/objects/commit.py.

I can't find documentation of git object format. But I tried to write support
GPG signature on commit object.

Please consider to merge.

Here is the way to reproduce problem:

sugi@vaj-k-334-sugi:~% mkdir signed-test
sugi@vaj-k-334-sugi:~% cd signed-test
sugi@vaj-k-334-sugi:~/signed-tes/% git init
Initialized empty Git repository in /home/sugi/signed-test/.git/
git@vaj-k-334-sugi:~/signed-test% date > date.txt
sugi@vaj-k-334-sugi:~/signed-test% git add .
sugi@vaj-k-334-sugi:~/signed-test% git commit -S -m 'Test commit with GPG sig.'

You need a passphrase to unlock the secret key for
user: "Tatsuki Sugiura "
1024-bit DSA key, ID 4502FDC2, created 2000-09-30

gpg: gpg-agent is not available in this session
[master (root-commit) afad9ad] Test commit with GPG sig.
1 file changed, 1 insertion(+)
create mode 100644 date.txt
sugi@vaj-k-334-sugi:~/signed-test% git cat-file commit HEAD
tree 9165a13698f6b211db3d9631958ef11e8d06d477
author Tatsuki Sugiura 1336266773 +0900
committer Tatsuki Sugiura 1336266773 +0900
gpgsig -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEABECAAYFAk+l0BUACgkQbK2FzkUC/cLR9wCeKUkjeA39+vy0T/TwJuqPhca3
eNMAnRw0tDNAqIcM4HJnHvzCsu86dLGV
=ZlAu
-----END PGP SIGNATURE-----

Test commit with GPG sig.
sugi@vaj-k-334-sugi:~/signed-test% python
Python 2.7.3rc2 (default, Apr 22 2012, 22:35:38)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import git
>>> git = git.Repo("/home/sugi/signed-test")
>>> git.commit()

>>> git.commit().author
afad9ad7986c98784288ae71deb696d505cdfe5c
Traceback (most recent call last):
File "", line 1, in
File "/home/sugi/lib/python2.7/site-packages/gitdb-0.5.4-py2.7-linux-x86_64.egg/gitdb/util.py", line 238, in __getattr__
self._set_cache_(attr)
File "/home/sugi/lib/python2.7/site-packages/GitPython-0.3.2.RC1-py2.7.egg/git/objects/commit.py", line 133, in _set_cache_
self._deserialize(StringIO(stream.read()))
File "/home/sugi/lib/python2.7/site-packages/GitPython-0.3.2.RC1-py2.7.egg/git/objects/commit.py", line 444, in _deserialize
self.author.name = self.author.name.decode(self.encoding)
LookupError: unknown encoding: -----BEGIN PGP SIGNATURE-----