Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Initialize submodule repository before handled failures
<!-- agent -->
Direct recursive updates with keep_going could swallow an invalid-name
validation error and then access mrepo before assignment. Reproduce that
path and initialize mrepo before validation so recursion is safely skipped.

Git baseline: submodule.c at 883a47ef6496c96a5d6132ed8c87fcd44ebf8d1a
validates submodule paths before operating on them.

Assisted-by: GPT 5.6
Co-authored-by: GPT 5.6 <codex@openai.com>
  • Loading branch information
Byron and codex committed Aug 4, 2026
commit b324c831cbc02c82b99c18113b622d03539d23cd
8 changes: 0 additions & 8 deletions .basedpyright/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -491,14 +491,6 @@
"lineCount": 1
}
},
{
"code": "reportPossiblyUnboundVariable",
"range": {
"startColumn": 15,
"endColumn": 20,
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
Expand Down
4 changes: 1 addition & 3 deletions git/objects/submodule/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,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
2 changes: 2 additions & 0 deletions test/test_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,8 @@ def test_root_update_keeps_going_after_invalid_submodule_name(self, rwdir):
assert not clone.submodule("../invalid").module_exists()
assert clone.submodule("valid").module_exists()

clone.submodule("../invalid").update(recursive=True, keep_going=True)

@with_rw_directory
@_patch_git_config("protocol.file.allow", "always")
def test_list_only_valid_submodules(self, rwdir):
Expand Down