Jelmer Vernooij 2 years ago
parent
commit
2832f4e7a9
3 changed files with 4 additions and 5 deletions
  1. 0 1
      dulwich/cli.py
  2. 2 2
      dulwich/porcelain.py
  3. 2 2
      dulwich/tests/test_porcelain.py

+ 0 - 1
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()

+ 2 - 2
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:

+ 2 - 2
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())