Bug 1247171 - Handle git config items with a line feed draft
authorMike Hommey <mh@glandium.org>
Wed, 10 Feb 2016 15:25:04 +0900
changeset 7207 174ecdfe7fda67cc210cc3bbeb3ec0fb37a86857
parent 7205 2c1cdef7972307aa3aac1e55e42c9a5e0e84a94f
child 7216 5f5a7620e31f9e848c42f83cffeac93c50f5b5a7
push id609
push userbmo:mh+mozilla@glandium.org
push dateWed, 10 Feb 2016 06:27:20 +0000
bugs1247171
Bug 1247171 - Handle git config items with a line feed
git/commands/git-mozreview
--- a/git/commands/git-mozreview
+++ b/git/commands/git-mozreview
@@ -160,24 +160,25 @@ def get_output(args):
     try:
         output = subprocess.check_output(args, stderr=subprocess.STDOUT)
         return 0, output
     except subprocess.CalledProcessError as e:
         return e.returncode, e.output
 
 
 def get_git_config():
-    res, output = get_output(['git', 'config', '--list'])
+    res, output = get_output(['git', 'config', '--list', '-z'])
     if res:
         raise AbortError('could not obtain git config')
 
     c = {}
-    for line in output.splitlines():
-        k, v = line.split('=', 1)
-        c[k] = v
+    for line in output.split('\0'):
+        if line:
+            k, v = line.split('\n', 1)
+            c[k] = v
 
     return c
 
 
 def get_commit_info(commits):
     """Obtain info about Git commits.
 
     A list of 2-tuples of commits in topological order oldest to newest will