Avoid mixing iterators/readline.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 16 Apr 2010 01:35:57 +0000 (03:35 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Fri, 16 Apr 2010 01:35:57 +0000 (03:35 +0200)
dulwich/patch.py

index 75e5c374f8d93107e16e170f71b41c5b37b31598..d922168fa000271be3b5603c4d4d6af899fa98d1 100644 (file)
@@ -150,8 +150,8 @@ def git_am_patch_split(f):
     c = Commit()
     c.author = msg["from"]
     c.committer = msg["from"]
-    if msg["subject"].startswith("[PATCH "):
-        subject = msg["subject"].split("]", 1)[1]
+    if msg["subject"].startswith("[PATCH"):
+        subject = msg["subject"].split("]", 1)[1][1:]
     else:
         subject = msg["subject"]
     c.message = subject
@@ -164,6 +164,5 @@ def git_am_patch_split(f):
         if l == "-- \n":
             break
         diff += l
-    version = f.readline().rstrip("\n")
-    assert f.read() == ""
+    version = f.next().rstrip("\n")
     return c, diff, version