diff options
author | Doesnot Matter <you@example.com> | 2022-05-26 18:20:39 +0200 |
---|---|---|
committer | Doesnot Matter <you@example.com> | 2022-05-26 19:29:38 +0200 |
commit | 3e30ce364e2a825355fcb30d6780cce508e8651b (patch) | |
tree | 868d1337d8b05eb373d8e458c40339f86293cafb | |
parent | 7740d59eec7c3bd9788667fc0118568eee04f36c (diff) |
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 <yshxxsjt715@gmail.com>".
See https://github.com/agx/git-buildpackage/pull/82
-rw-r--r-- | gbp/git/repository.py | 5 |
1 files changed, 3 insertions, 2 deletions
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) |