Add test for subject parsing in git_am_patch_split.
authorJelmer Vernooij <jelmer@samba.org>
Tue, 5 Oct 2010 20:44:41 +0000 (22:44 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 5 Oct 2010 20:44:41 +0000 (22:44 +0200)
dulwich/patch.py
dulwich/tests/test_patch.py

index 27cd8b8..2c253df 100644 (file)
@@ -155,7 +155,8 @@ def git_am_patch_split(f):
     c.author = msg["from"]
     c.committer = msg["from"]
     if msg["subject"].startswith("[PATCH"):
-        subject = msg["subject"].split("]", 1)[1][1:]
+        close = msg["subject"].index("] ")
+        subject = msg["subject"][close+2:]
     else:
         subject = msg["subject"]
     c.message = subject
index 5ecacec..18d2444 100644 (file)
@@ -82,6 +82,8 @@ Subject: [PATCH 1/2] Remove executable bit from prey.ico (triggers a lintian war
         c, diff, version = git_am_patch_split(StringIO(text))
         self.assertEquals("Jelmer Vernooij <jelmer@samba.org>", c.committer)
         self.assertEquals("Jelmer Vernooij <jelmer@samba.org>", c.author)
+        self.assertEquals("Remove executable bit from prey.ico "
+            "(triggers a lintian warning).", c.message)
         self.assertEquals(""" pixmaps/prey.ico |  Bin 9662 -> 9662 bytes
  1 files changed, 0 insertions(+), 0 deletions(-)
  mode change 100755 => 100644 pixmaps/prey.ico