Commit Diff


commit - 3873ba72b463b9b947a0578874325a39a1b46045
commit + 2832f4e7a97560c39b8667c1607dae2db145ef93
blob - 4cc5a09aeea0f75e629040405fe595d27447818e
blob + f95b9f261153cd7fe558ac18c14ddd56b29492f8
--- dulwich/cli.py
+++ dulwich/cli.py
@@ -329,7 +329,6 @@ class cmd_submodule(Command):
             sys.stdout.write(' %s %s\n' % (sha, path))
 
 
-
 class cmd_tag(Command):
     def run(self, args):
         parser = optparse.OptionParser()
blob - 9d697e8cb6383a0d482f14306db6d2718791a376
blob + e79e90df8ea2fce01ac99c78fa64ceac09c21890
--- dulwich/porcelain.py
+++ dulwich/porcelain.py
@@ -877,12 +877,12 @@ def submodule_add(repo, url, path=None, name=None):
     """
     with open_repo_closing(repo) as r:
         if path is None:
-            path = os.path.relpath(canonical_part(url), repo.path)
+            path = os.path.relpath(_canonical_part(url), r.path)
         if name is None:
             name = path
 
         # TODO(jelmer): Move this logic to dulwich.submodule
-        gitmodules_path = os.path.join(repo.path, ".gitmodules")
+        gitmodules_path = os.path.join(r.path, ".gitmodules")
         try:
             config = ConfigFile.from_path(gitmodules_path)
         except FileNotFoundError:
blob - 666a9198bb408cc8aee3763217a7fcf464cf7ea0
blob + acd8a6b468cbea39edb1d8a0ac2821978ee490aa
--- dulwich/tests/test_porcelain.py
+++ dulwich/tests/test_porcelain.py
@@ -1425,8 +1425,8 @@ class SubmoduleTests(PorcelainTestCase):
         with open('%s/.gitmodules' % self.repo.path, 'r') as f:
             self.assertEqual("""\
 [submodule "bar"]
-	url = ../bar.git
-	path = bar
+\turl = ../bar.git
+\tpath = bar
 """, f.read())