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

Re: [PATCH v2 3/3] batch check whether submodule needs pushing into one call

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 12, 2016, 17:37 UTC
Message-ID
<xmqqwphd4gf6.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161012133338.GD84247@book.hvoigt.net>
Heiko Voigt <hvoigt@hvoigt.net> writes:
Show 10 quoted lines
>> If we do not even have these commits locally, then there is no point
>> attempting to push, so returning 0 (i.e. it is not "needs pushing"
>> situation) is correct but it is a but subtle.  It's not "we know
>> they already have them", but it is "even if we tried to push, it
>> won't do us or the other side any good."  A single-liner in-code
>> comment may help.
>
> First the naming part. How about:
>
> 	submodule_has_commits()
Nice.
> Returning 0 here means: "No push needed" but the correct answer would
> be: "We do not know". 

Is it? Perhaps I am misreading the "submodule-has-commits"; I thought it was "the remote may or may not need updating, but we ourselves don't have what they may need to have commits in their submodule that are referenced by their superproject, so it would not help them even if we pushed our submodule to them". It indeed is different from "No push needed" (rather, "our pushing would be pointless").

Show 9 quoted lines
> So how about:
>
>
> 	if (!submodule_has_hashes(path, hashes))
> 		/* NEEDSWORK: The correct answer here is "We do not
> 		 * know" instead of "No". We currently proceed pushing
> 		 * here as if the submodules commits are available on a
> 		 * remote, which is not always correct. */
> 		return 0;
I am not sure.  
What should happen in this scenario?
 * We have two remotes, A and B, for our superproject.
 * We are not interested in one submodule at path X.  Our repository
   is primarily used to work on the superproject and possibly other
   submodules but not the one at path X.
 * We pulled from A to update ourselves.  They were actively working
   on the submodule we are not interested in, and path X in the
   superproject records a new commit that we do not have.
 * We are now trying to push to B.
Should different things happen in these two subcases?
 - We are not interested in submodule at path X, so we haven't even
   done "submodule init" on it.
 - We are not interested in submodule at path X, so even though we
   do have a rather stale clone of it, we do not usually bother
   updating what is checked out at path X and commit our changes
   outside that area.

I tend to think that in these two cases the same thing should happen. I am not sure if that same thing should be rejection (i.e. "you do not know for sure that the commit at path X of the superproject you are pushing exists in the submodule repository at the receiving end, so I'd refuse to push the superproject"), as it makes the only remedy for the situation is for you to make a full clone of the submodule you are not interested in and you have never touched yourself in either of these two subcases.

Previous: Heiko VoigtNext: Heiko Voigt
Message 18 of 19 in “Speedup finding of unpushed submodules”
  1. 0/3 Speedup finding of unpushed submodulesHeiko Voigt, Oct 7, 2016
  2. 1/3 serialize collection of changed submodulesHeiko Voigt, Oct 7, 2016
  3. Stefan BellerOct 7, 2016
  4. Junio C HamanoOct 10, 2016
  5. Heiko VoigtOct 12, 2016
  6. Junio C HamanoOct 12, 2016
  7. Heiko VoigtOct 13, 2016
  8. Heiko VoigtOct 12, 2016
  9. 2/3 serialize collection of refs that contain submodule changesHeiko Voigt, Oct 7, 2016
  10. Stefan BellerOct 7, 2016
  11. Heiko VoigtOct 12, 2016
  12. Stefan BellerOct 20, 2016
  13. Junio C HamanoOct 10, 2016
  14. 3/3 batch check whether submodule needs pushing into one callHeiko Voigt, Oct 7, 2016
  15. Stefan BellerOct 7, 2016
  16. Junio C HamanoOct 10, 2016
  17. Heiko VoigtOct 12, 2016
  18. Junio C HamanoOct 12, 2016
  19. Heiko VoigtOct 13, 2016

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.