diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-11-24 22:53:24 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-11-24 22:53:24 +0100 |
commit | cf1d5bd4208514bab3e6ee523a70dff8176c8c80 (patch) | |
tree | d68f6529275838b9a962c4b76533e8445441af34 /objects/commit.py | |
parent | 3175b5b21194bcc8f4448abe0a03a98d3a4a1360 (diff) | |
parent | 7da101ba9a09a22a85c314a8909fd23468ae66f0 (diff) | |
download | gitpython-cf1d5bd4208514bab3e6ee523a70dff8176c8c80.tar.gz |
Merge branch 'reflogintegration'
Diffstat (limited to 'objects/commit.py')
-rw-r--r-- | objects/commit.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/objects/commit.py b/objects/commit.py index 9c7e66a3..69a3adc4 100644 --- a/objects/commit.py +++ b/objects/commit.py @@ -350,13 +350,13 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): # as well ... import git.refs try: - repo.head.commit = new_commit + repo.head.set_commit(new_commit, logmsg="commit: %s" % message) except ValueError: # head is not yet set to the ref our HEAD points to # Happens on first commit import git.refs - master = git.refs.Head.create(repo, repo.head.ref, commit=new_commit) - repo.head.reference = master + master = git.refs.Head.create(repo, repo.head.ref, commit=new_commit, logmsg="commit (initial): %s" % message) + repo.head.set_reference(master, logmsg='commit: Switching to %s' % master) # END handle empty repositories # END advance head handling @@ -382,7 +382,12 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): self.authored_date, altz_to_utctz_str(self.author_tz_offset))) - write(fmt % ("committer", c.name, c.email, + # encode committer + aname = c.name + if isinstance(aname, unicode): + aname = aname.encode(self.encoding) + # END handle unicode in name + write(fmt % ("committer", aname, c.email, self.committed_date, altz_to_utctz_str(self.committer_tz_offset))) @@ -440,6 +445,13 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): print >> sys.stderr, "Failed to decode author name '%s' using encoding %s" % (self.author.name, self.encoding) # END handle author's encoding + # decode committer name + try: + self.committer.name = self.committer.name.decode(self.encoding) + except UnicodeDecodeError: + print >> sys.stderr, "Failed to decode committer name '%s' using encoding %s" % (self.committer.name, self.encoding) + # END handle author's encoding + # a stream from our data simply gives us the plain message # The end of our message stream is marked with a newline that we strip self.message = stream.read() |