Handle invalid submodule names during recursive updates by Byron · Pull Request #2205 · gitpython-developers/GitPython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .basedpyright/baseline.json
7 changes: 3 additions & 4 deletions git/objects/submodule/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,9 @@ def _validated_name(cls, name: str) -> str:

@classmethod
def _module_abspath(cls, parent_repo: "Repo", path: PathLike, name: str) -> PathLike:
name = cls._validated_name(name)
if cls._need_gitfile_submodules(parent_repo.git):
return osp.join(parent_repo.git_dir, "modules", cls._validated_name(name))
return osp.join(parent_repo.git_dir, "modules", name)
if parent_repo.working_tree_dir:
return osp.join(parent_repo.working_tree_dir, path)
raise NotADirectoryError()
Expand Down Expand Up @@ -747,9 +748,7 @@ def update(
prefix = "DRY-RUN: "
# END handle prefix

# To keep things plausible in dry-run mode.
if dry_run:
mrepo = None
mrepo = None
# END init mrepo

def fetch_remotes(module_repo: "Repo") -> None:
Expand Down
6 changes: 6 additions & 0 deletions test/test_submodule.py
Loading