Fetching missing submodule refs unnecessarily fatal
[re adding list, woops!]
Quoted 27 lines · Mike Crowe
Quoted 14 lines · Ben Knoble
Quoted 8 lines
Quoted 2 lines · Mike Crowe
When Git fetches in a superproject with --recurse-submodules, it appears to try to fetch the corresponding submodule repository commits for every new or updated superproject branch. Presumably this is so that everthing is ready to switch to one of those branches without further fetching.
Quoted 5 lines
Developers may create commits that contain submodules that reference commits in the submodule repository, but those commits may not be pushed to the submodule's remote repository. When the superproject commits are pushed to a personal remote branch anyone else's Git fetch cannot find the corresponding submodule commit and fails.
Quoted 4 lines
This is the part that confuses me: if a (public) commit of history refers to a submodule at a particular commit, and that commit is not available anywhere, then we won’t be able to properly update submodules when using that commit. That creates a problem!
It does. But only for that user's personal branch. Even though it is public, a personal branch is mostly only for the use of that user and it doesn't matter to anyone but them. (The user is probably working simultaneously on both the superproject and the submodule.)
Quoted 5 lines
Quoted 1 line
Why not instead make sure the submodule commit is also available for fetching?
This relies on the user realising what they've done. They might even think that they've made the right submodule commit available but forgot that they rebased it before pushing or something changing the commit hash.
Yeah, the recurse-submodules option for pushing makes this easier to notice/act on, too.
Quoted 6 lines
From a resilience point of view it shouldn't be possible for someone who can push changes to their own personal branch to perform a "denial of service" on anyone else fetching from the repository by making that fetch fail.
I hope this makes it clearer.
That does make some sense: I wouldn’t want to get interrupted by a colleague or collaborator’s bad push of an unrelated branch.
Quoted 5 lines
Thanks.
Mike.
(Was there a reason that you didn't reply to the list?)
Nope, mis-click.