changeset 209:fbdacc889143

merge the fix for the encoding field bug
author Abderrahim Kitouni <a.kitouni@gmail.com>
date Fri, 03 Jul 2009 16:46:26 +0100
parents c06ac5b982a9 (current diff) 626d7c0160df (diff)
children 9a27c618d0ed
files
diffstat 3 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dulwich/objects.py
+++ b/dulwich/objects.py
@@ -609,8 +609,7 @@
                      "%s must be followed by space not %s" % (ENCODING_ID, text[count])
                 count += 1
                 self._encoding = text[count:].split("\n", 1)[0]
-                while text[count] != "\n":
-                    count += 1
+                count += len(self._encoding) + 1
         count += 1
         self._message = text[count:]
         self._needs_parsing = False
--- a/dulwich/repo.py
+++ b/dulwich/repo.py
@@ -359,7 +359,7 @@
         commit_data += 'author ' + commit['author'] + "\n"
         commit_data += 'committer ' + commit['committer'] + "\n"
         if 'encoding' in commit:
-            commit_data += 'encoding ' + commit['encoding']
+            commit_data += 'encoding ' + commit['encoding'] + "\n"
         commit_data += "\n"
         commit_data += commit['message']
         sha = self.write_object('commit', commit_data)
--- a/tests/test-encoding.out
+++ b/tests/test-encoding.out
@@ -17,7 +17,7 @@
 at: 0/4
 updating working directory
 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
-@  changeset:   3:4194aac3187933e5859d85d8f572234e41f79f3d
+@  changeset:   3:983a70eb26960008c2d503306d2c2b047e1b2c0c
 |  tag:         master
 |  tag:         default/master
 |  tag:         tip
@@ -31,7 +31,7 @@
 |  extra:       branch=default
 |  extra:       committer=test <test@example.org> 1167609613 0
 |  extra:       encoding=latin-1
-|  extra:       message=\nadd d\xe9lt\xe0\n
+|  extra:       message=add d\xe9lt\xe0\n
 |  description:
 |  add déltà
 |