Repository navigation
Skip .gitmodules entries that have no gitlink - #5
Merged
mbid merged 3 commits intoOct 13, 2026
Merged
Conversation
Removing a submodule from the tree can leave its .gitmodules section behind. Git ignores such an entry, but pod setup took the submodule list from .gitmodules alone and ran `git submodule init <path>` for each one, which fails when the path is not a gitlink and aborted the whole container setup. Only keep entries whose path the index records as a gitlink, which is what git itself treats as a submodule, and warn on stderr about the rest. The detection now returns a Result so that a failing index lookup stops setup instead of silently dropping every submodule. Fixes NVIDIA#2 Signed-off-by: Max Freedom Pollard <272618364+MaxFreedomPollard@users.noreply.github.com>
Signed-off-by: Martin Bidlingmaier <bidlingmaier@nvidia.com>
Exercise regular-file and nested stale entries, and keep the restart fixture reaching the uninitialized-worktree guard after index filtering. Signed-off-by: Martin Bidlingmaier <bidlingmaier@nvidia.com>
Collaborator
|
Merged, thanks Max! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2.
Pod setup took the list of submodules from
.gitmodulesalone and rangit submodule init <path>for each entry. For a section left behind after its submodule was removed from the tree, that fails withpathspec ... did not match any file(s) known to gitand aborts the whole container setup.detect_submodules_from_gitmodulesnow keeps only the entries whose path the index records as a gitlink (mode 160000 ingit ls-files --stage), which is what git itself treats as a submodule, and warns on stderr about the ones it skips.--literal-pathspecskeeps a submodule path with glob characters from being read as a pattern. The function returns aResultnow, so a failing index lookup stops setup instead of silently dropping every submodule. Nothing changes on the host side, wheregit submodule foreachalready visits gitlinks only.Testing
New integration test
stale_gitmodules_entry_does_not_break_setup: a repo with one real submodule and one stale section. It asserts thatrumpel entersucceeds and that the real submodule is checked out at the commit the parent records.I ran the full pipeline through the CI workflow on my fork, once with only the new test and once with the fix:
submodule setup failed: ... "git" "submodule" "init" "removed", 617 passed and 1 failed on linux-amd64. The linux-arm64 job also hadcodex_permissions_new_threads_keep_default_bypassfail, which passed in the other three runs.One note: CONTRIBUTING.md says to open pull requests against
master, but the default branch ismain, so this targetsmain.