Conversation
jeffro256
force-pushed
the
submodule_update_no_fetch
branch
3 times, most recently
from
September 17, 2026 16:50
1c5736d to
1d855b7
Compare
Author
|
Force=pushed changes to make the linter happy |
Member
|
Thanks! Seems simple and useful at the same time. |
Byron
force-pushed
the
submodule_update_no_fetch
branch
from
September 20, 2026 10:34
1d855b7 to
7140bcc
Compare
Byron
force-pushed
the
submodule_update_no_fetch
branch
from
September 20, 2026 11:07
7140bcc to
f49cc2f
Compare
- Add tests - [P2] Disable lazy fetching during no-fetch updates — git/objects/submodule/base.py:865-866 For a partial-cloned submodule (for example, using `--filter=blob:none`), the target commit can be cached while its blobs are missing. Skipping `Remote.fetch` does not prevent the later checkout/reset from implicitly fetching those blobs. I reproduced `update(no_fetch=True)` spawning `git fetch origin ... --stdin` despite this guard. This violates the documented local-only behavior. Disable Git's lazy fetching for commands executed in this mode, including checkout and restoration. - [P2] Propagate no_fetch to recursive root-module updates — git/objects/submodule/root.py:442-442 For repositories with nested submodules, `Repo.submodule_update(no_fetch=True)` still fetches nested remotes. The flag reaches this immediate `sm.update(recursive=False, ...)`, but the subsequent `type(self)(sm.module()).update(...)` call omits it and defaults to `False`. Since root updates recurse by default, offline updates fail even when all required objects are cached. Forward the flag to the recursive call too. - [P2] Skip the branch-change fetch loop when no_fetch is set — git/objects/submodule/root.py:90-90 When `.gitmodules` changes a submodule's configured branch, the branch-change handler still unconditionally calls `remote.fetch(...)` for every remote. Consequently, even `submodule_update(recursive=False, no_fetch=True)` accesses remotes and fails offline, including when the target remote-tracking branch already exists locally. Guard that fetch loop with this flag as well. - [P2] Handle URL changes without requiring freshly fetched refs — git/objects/submodule/root.py:282-283 When a submodule's URL changes with `no_fetch=True`, the newly created `__new_origin__` remote has no refs, so the following `smr.refs` branch check raises `ValueError`. This occurs even when switching to an identical mirror with all required history cached locally, and leaves the temporary remote behind. The no-fetch path must handle the fetch-dependent validation and remote replacement, not merely skip this fetch. - [P2] Allow restoring retained repositories without fetching — git/objects/submodule/base.py:893-896 After `git submodule deinit`, the retained repository under `.git/modules/<name>` can already contain the requested commit. This branch has validated that repository but now rejects `update(init=True, no_fetch=True)` merely because its checkout is empty. Reconnecting the repository and restoring cached contents requires no network access; native `git submodule update --init --no-fetch` succeeds in this case. Allow restoration and conditionally skip the later `fetch_remotes(mrepo)` instead. Assisted-by: GPT 6.0 Co-authored-by: GPT 6.0 <codex@openai.com>
Byron
force-pushed
the
submodule_update_no_fetch
branch
from
September 20, 2026 11:55
f49cc2f to
a83262b
Compare
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.
Enables behavior similar to
git submodule update --no-fetch. Useful for A) builds with "online" then "offline" stages, and B) saving time while performing many checkouts and recursive submodule updates when you know that you have the commits locally.