On Thu, Aug 19, 2021 at 09:09:46PM -0400, Derrick Stolee wrote: > > On 8/19/2021 4:09 PM, Emily Shaffer wrote: > > Since v2, mostly documentation changes and a handful of small nits from > > Junio and Jonathan Tan. Thanks for the reviews, both. > > Sorry to show up late with many questions (mostly because my understanding > of submodules is not as strong as yours), Well, here I am apologizing for showing up even later with a reply ;) > but I do have some concerns that > we have not covered all the cases that could lead to the relative path > needing an update, such as a 'git checkout' across commits in the super- > project which moves a submodule. > > Leading more to my confusion is that I thought 'git submodule update' > was the way to move a submodule, but that does not appear to be the case. > I used 'git mv' to move a submodule and that correctly updated the > .gitmodules file, but did not run any 'git submodule' subcommands (based > on GIT_TRACE2_PERF=1). During a live review a few weeks ago it was pointed out, I forget by who, that this whole series would make a lot more sense if it was treated as the path from the submodule's gitdir to the superproject's gitdir. I think this would also fix your 'git mv' example here, as the submodule gitdir would not change. > > You mention in an earlier cover letter that this config does not need to > exist, but it seems to me that if it exists it needs to be correct for us > to depend on it for future features. I'm not convinced that we can rely > on it as-written, but you might be able to convince me by pointing out > why these submodule movements are safe. Yeah, that is a good point, and I wonder how to be defensive about this... Maybe it makes sense to BUG() if we don't find the superproject's gitdir from this config? Maybe it makes sense to warn (asking users to 'git submodule update') and erase the incorrect config line? Both those approaches would require a wrapper around 'git_config_get_string()' to cope with a failure, but it might be worth it. I'll try proposing such a wrapper in the reroll, unless I hear back sooner. - Emily