diff hgext/convert/git.py @ 25698:307370c2dda2

convert: handle .gitmodules with non-tab whitespaces The old implementation assumed .gitmodules file lines always began with tabs. It can be any whitespace, so lets trim the lines appropriately.
author Durham Goode <durham@fb.com>
date Mon, 29 Jun 2015 17:19:18 -0700
parents 216fa1ba9993
children 5c97a4ecbdd4
line wrap: on
line diff
--- a/hgext/convert/git.py	Mon Jun 29 13:39:05 2015 -0700
+++ b/hgext/convert/git.py	Mon Jun 29 17:19:18 2015 -0700
@@ -174,8 +174,9 @@
         """
         self.submodules = []
         c = config.config()
-        # Each item in .gitmodules starts with \t that cant be parsed
-        c.parse('.gitmodules', content.replace('\t',''))
+        # Each item in .gitmodules starts with whitespace that cant be parsed
+        c.parse('.gitmodules', '\n'.join(line.strip() for line in
+                               content.split('\n')))
         for sec in c.sections():
             s = c[sec]
             if 'url' in s and 'path' in s: