Mageia Bugzilla – Attachment 7857 Details for
Bug 18540
[PATCH] gitpython fails on gpg signed commits
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
patch from mentioned pullrequest 57, rediffed to make it apply cleanly to 0.3.1-9
gpg-signed-commit.patch (text/plain), 2.27 KB, created by
Christian Lohmaier
on 2016-05-25 19:54:41 CEST
(
hide
)
Description:
patch from mentioned pullrequest 57, rediffed to make it apply cleanly to 0.3.1-9
Filename:
MIME Type:
Creator:
Christian Lohmaier
Created:
2016-05-25 19:54:41 CEST
Size:
2.27 KB
patch
obsolete
>https://github.com/gitpython-developers/GitPython/pull/57.patch > >rediffed to apply >diff -ru git-python-mainline_orig/git/objects/commit.py git-python-mainline/git/objects/commit.py >--- git-python-mainline_orig/git/objects/commit.py 2011-01-17 23:15:14.000000000 +0100 >+++ git-python-mainline/git/objects/commit.py 2016-05-25 19:36:27.919503124 +0200 >@@ -57,12 +57,12 @@ > __slots__ = ("tree", > "author", "authored_date", "author_tz_offset", > "committer", "committed_date", "committer_tz_offset", >- "message", "parents", "encoding") >+ "message", "parents", "encoding", "gpgsig") > _id_attribute_ = "binsha" > > def __init__(self, repo, binsha, tree=None, author=None, authored_date=None, author_tz_offset=None, > committer=None, committed_date=None, committer_tz_offset=None, >- message=None, parents=None, encoding=None): >+ message=None, parents=None, encoding=None, gpgsig=None): > """Instantiate a new Commit. All keyword arguments taking None as default will > be implicitly set on first query. > >@@ -120,6 +120,9 @@ > self.parents = parents > if encoding is not None: > self.encoding = encoding >+ self.gpgsig = None >+ if gpgsig is not None: >+ self.gpgsig = gpgsig > > @classmethod > def _get_intermediate_items(cls, commit): >@@ -393,6 +396,9 @@ > > if self.encoding != self.default_encoding: > write("encoding %s\n" % self.encoding) >+ >+ if self.gpgsig: >+ write("gpgsig %s" % self.gpgsig) > > write("\n") > >@@ -429,15 +435,20 @@ > # now we can have the encoding line, or an empty line followed by the optional > # message. > self.encoding = self.default_encoding >- # read encoding or empty line to separate message >- enc = readline() >- enc = enc.strip() >- if enc: >- self.encoding = enc[enc.find(' ')+1:] >- # now comes the message separator >- readline() >- # END handle encoding >- >+ >+ # read headers >+ buf = readline().strip() >+ while buf != "": >+ if buf[0:10] == "encoding ": >+ self.encoding = buf[buf.find(' ')+1:] >+ elif buf[0:7] == "gpgsig ": >+ sig = buf[buf.find(' ')+1:] + "\n" >+ while True: >+ sig += readline() >+ if sig.find("END PGP SIGNATURE") > -1: break >+ self.gpgsig = sig >+ buf = readline().strip() >+ > # decode the authors name > try: > self.author.name = self.author.name.decode(self.encoding)
https://github.com/gitpython-developers/GitPython/pull/57.patch rediffed to apply diff -ru git-python-mainline_orig/git/objects/commit.py git-python-mainline/git/objects/commit.py --- git-python-mainline_orig/git/objects/commit.py 2011-01-17 23:15:14.000000000 +0100 +++ git-python-mainline/git/objects/commit.py 2016-05-25 19:36:27.919503124 +0200 @@ -57,12 +57,12 @@ __slots__ = ("tree", "author", "authored_date", "author_tz_offset", "committer", "committed_date", "committer_tz_offset", - "message", "parents", "encoding") + "message", "parents", "encoding", "gpgsig") _id_attribute_ = "binsha" def __init__(self, repo, binsha, tree=None, author=None, authored_date=None, author_tz_offset=None, committer=None, committed_date=None, committer_tz_offset=None, - message=None, parents=None, encoding=None): + message=None, parents=None, encoding=None, gpgsig=None): """Instantiate a new Commit. All keyword arguments taking None as default will be implicitly set on first query. @@ -120,6 +120,9 @@ self.parents = parents if encoding is not None: self.encoding = encoding + self.gpgsig = None + if gpgsig is not None: + self.gpgsig = gpgsig @classmethod def _get_intermediate_items(cls, commit): @@ -393,6 +396,9 @@ if self.encoding != self.default_encoding: write("encoding %s\n" % self.encoding) + + if self.gpgsig: + write("gpgsig %s" % self.gpgsig) write("\n") @@ -429,15 +435,20 @@ # now we can have the encoding line, or an empty line followed by the optional # message. self.encoding = self.default_encoding - # read encoding or empty line to separate message - enc = readline() - enc = enc.strip() - if enc: - self.encoding = enc[enc.find(' ')+1:] - # now comes the message separator - readline() - # END handle encoding - + + # read headers + buf = readline().strip() + while buf != "": + if buf[0:10] == "encoding ": + self.encoding = buf[buf.find(' ')+1:] + elif buf[0:7] == "gpgsig ": + sig = buf[buf.find(' ')+1:] + "\n" + while True: + sig += readline() + if sig.find("END PGP SIGNATURE") > -1: break + self.gpgsig = sig + buf = readline().strip() + # decode the authors name try: self.author.name = self.author.name.decode(self.encoding)
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 18540
: 7857