From: Doesnot Matter Date: Thu, 26 May 2022 16:20:39 +0000 (+0200) Subject: repository.get_submodules: Only strip repo path from the beginning X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e30ce364e2a825355fcb30d6780cce508e8651b;p=tools%2Fgit-buildpackage.git repository.get_submodules: Only strip repo path from the beginning We shouldn't just replace any occurence since we otherwise might also substitute in the submodule. Based on a patch by "ushen ". See https://github.com/agx/git-buildpackage/pull/82 --- diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 01226804..4d11fae6 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -1984,8 +1984,9 @@ class GitRepository(object): # A submodules is shown as "commit" object in ls-tree: if objtype == "commit": nextpath = os.path.join(path, name) - submodules.append((nextpath.replace(self.path, '').lstrip('/'), - commit)) + if nextpath.startswith(self.path): + nextpath = nextpath[len(self.path):].lstrip('/') + submodules.append((nextpath, commit)) if recursive: submodules += self.get_submodules(commit, path=nextpath, recursive=recursive)