git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] push: do not add submodule odb as an alternate when recursing on demand

From
Stefan Beller <sbeller@google.com>
Date
Aug 16, 2017, 05:52 UTC
Message-ID
<CAGZ79kaUgPmoPw7XGY6qxc64_5DygfX4xM5noX4E5EW6=Ejm+Q@mail.gmail.com>
In-Reply-To
<20170816020809.GI13924@aiede.mtv.corp.google.com>
On Tue, Aug 15, 2017 at 7:08 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 34 quoted lines
> Hi,
>
> Stefan Beller wrote:
>> On Tue, Aug 15, 2017 at 5:11 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Stefan Beller <sbeller@google.com> writes:
>>>> Junio C Hamano wrote:
>
>>>>> Is "is it populated" a good thing to check here, though?  IIRC,
>>>>> add-submodule-odb allows you to add the object database of an
>>>>> inactivated submodule, so this seems to change the behaviour.  I do
>>>>> not know if the behaviour change is a good thing (i.e. bugfix) or
>>>>> not (i.e. regression) offhand, though.
>>>>
>>>> Good point, we should be able to push non-populated, even inactive(?)
>>>> submodules. For that we strictly need add_submodule_odb here
>>>> (or the repo object of the submodule, eventually).
>>>>
>>>> So let's retract this patch for now.
>>>
>>> Not so fast.
>>
>> Ok, I took another look at the code.
>>
>> While we may desire that un-populated submodules can be pushed
>> (due to checking out another revision where the submodule
>> doesn't exist, before pushing), this is not supported currently, because
>> the call to run the push in the submodule assumes there is a
>> "<path>/.git" on which the child process can operate.
>> So for now we HAVE to have the submodule populated.
>
> It was not immediately obvious to me that this is just "for now".
>
> I would be really confused if I had deactivated a submodule and
> "git push --recurse-submodules" pushed from it anyway.
agreed.
>  If the
> submodule is active but not populated, then the question becomes "Why
> wasn't it populated?"

because you checked out a different revision where the sub is not part of the working tree, for example. As long as you have locally interesting "stuff" you want to transfer it. (IMHO even when the sub is not active)

> If this is a bare repository, then nothing is populated,

Currently bare repos do not support having submodules AT ALL, i.e. there is no modules/<name> directory where the submodules would have any valuable information. instead we *only* have the .gitmodules files at e.g. HEAD.

> and pushing
> from an active-but-unpopulated submodule sounds like a plausible wish.
it seems we're on the same page here.
> But in a non-bare repository, I'm having trouble imagining the use
> case that brings this situation about.

git checkout revision-with-sub # hack.. hack.. hack.. "git commit --recurse-submodules -m bugfix" # ^ not yet implemented git checkout revision-without-sub # Oh! I forgot to push the bugfix git push --recurse-submodule <bugfix>

Show 5 quoted lines
> And where people have been needing this so far has been non-bare
> repositories.  In that context, the check "is active and populated"
> does not seem unusual or provisional.  Are you hinting that replacing
> the check with "is active" would make it work well in bare
> repositories?
No I was saying:
* currently the code only works when "is populated"
* currently "is active" seems not to be considered
* in the future the code shall work even when not "is populated",
  (but submodule git dir is there at the very least)
* we may want to discuss if we want to care about "is active"
  additionally
>  I think I agree, though you'd have to be careful about
> the case where the submodule is active but hasn't been fetched to
> $GIT_DIR/modules yet.

When not fetched yet, there is no modules/<name> git dir and we are sure there is no locally interesting information, so we want to omit the push. (see above "has git dir" is the minimum requirement, as opposed to current "is populated".

> Thanks,
> Jonathan
Previous: Jonathan NiederNext: Heiko Voigt
Message 19 of 20 in “submodule: use cheaper check for submodule pushes”
  1. submodule: use cheaper check for submodule pushesStefan Beller, Jul 12, 2017
  2. Jonathan NiederJul 13, 2017
  3. Stefan BellerJul 13, 2017
  4. Junio C HamanoJul 13, 2017
  5. Stefan BellerJul 13, 2017
  6. Junio C HamanoJul 13, 2017
  7. Stefan BellerJul 13, 2017
  8. Jonathan NiederJul 13, 2017
  9. Stefan BellerJul 13, 2017
  10. push: do not add submodule odb as an alternate when recursing on demandStefan Beller, Aug 15, 2017
  11. Jonathan NiederAug 15, 2017
  12. Jonathan NiederAug 15, 2017
  13. Stefan BellerAug 15, 2017
  14. Junio C HamanoAug 15, 2017
  15. Stefan BellerAug 15, 2017
  16. Junio C HamanoAug 16, 2017
  17. Stefan BellerAug 16, 2017
  18. Jonathan NiederAug 16, 2017
  19. Stefan BellerAug 16, 2017
  20. Heiko VoigtAug 16, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.