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

Re: Possible regression in master? (submodules without a "master" branch)

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 27, 2014, 19:39 UTC
Message-ID
<xmqqwqffctyg.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140327185405.GS4008@odin.tremily.us>
"W. Trevor King" <wking@tremily.us> writes:
Show 25 quoted lines
> On Thu, Mar 27, 2014 at 06:31:27PM +0100, Jens Lehmann wrote:
>> Am 27.03.2014 18:16, schrieb Junio C Hamano:
>> > Johan Herland <johan@herland.net> writes:
>> > 
>> >> I just found a failure to checkout a project with submodules where
>> >> there is no explicit submodule branch configuration, and the
>> >> submodules happen to not have a "master" branch:
>> >>
>> >>   git clone git://gitorious.org/qt/qt5.git qt5
>> >>   cd qt5
>> >>   git submodule init qtbase
>> >>   git submodule update
>> >>
>> >> In current master, the last command fails with the following output:
>> > 
>> > ... and with a bug-free system, what does it do instead?  Just clone
>> > 'qtbase' and make a detached-head checkout at the commit recorded in
>> > the superproject's tree, or something else?
>> 
>> After reverting 23d25e48f5ead73 on current master it clones 'qtbase'
>> nicely with a detached HEAD.
>
> Fixing this for initial update clone is pretty easy, we just need to
> unset start_point before calling module_clone if
> submodule.<name>.branch is not set. 
There is this bit for "update" in git-submodule.txt:
  For updates that clone missing submodules, checkout-mode updates
  will create submodules with detached HEADs; all other modes will
  create submodules with a local branch named after
  submodule.<path>.branch.
  [side note] Isn't that a typo of submodule.<name>.branch?

So the proposed change is to make the part before semicolon true? If we are not newly cloning (because we already have it), if the submodule.<name>.branch is not set *OR* refers to a branch that does not even exist, shouldn't we either (1) abort as an error, or (2) do the same and detach?

Show 10 quoted lines
> However, that's just going to
> push remote branch ambiguity problems back to the --remote update
> functionality.  What should happen when submodule.<name>.branch is not
> set and you run a --remote update, which has used:
>
>     git rev-parse "${remote_name}/${branch}"
>
> since the submodule.<name>.branch setting was introduced in 06b1abb
> (submodule update: add --remote for submodule's upstream changes,
> 2012-12-19)?

Isn't --remote about following one specific branch the user who issues that command has in mind? If you as the end user did not give any indication which branch you meant, e.g. by leaving the submodule.<name>.branch empty, shouldn't that be diagnosed as an error?

> gitmodules(5) is pretty clear that 'submodule.<name>.branch' defaults
> to master (and not upstream's HEAD), do we want to adjust this at the
> same time?

That may be likely. If the value set to a configuration variable causes an established behaviour of a program change a lot, silently defaulting that variable to something many people are expected to have (e.g. 'master') would likely to cause a usability regression.

Show 9 quoted lines
>> > If an existing set-up that was working in a sensible way is broken
>> > by a change that assumes something that should not be assumed,
>> > then that is a serious regression, I would have to say.
>> 
>> Yes, especially as it promised to not change this use case.
>
> Sorry.  A side effect of relying too much on our existing
> documentation and not enough on testing actual use cases.  I can work
> up some non-master submodule tests to go with the fix.

I was wondering if we need to revert the merge with that branch out of 'master', or submodule folks can work on a set of fixes to apply on top.

Will wait to see how it goes.  Thanks.
Previous: W. Trevor KingNext: Heiko Voigt
Message 12 of 29 in “Possible regression in master? (submodules without a "master" branch)”
  1. Johan HerlandMar 27, 2014
  2. W. Trevor KingMar 27, 2014
  3. W. Trevor KingMar 27, 2014
  4. Jens LehmannMar 27, 2014
  5. Junio C HamanoMar 27, 2014
  6. Jens LehmannMar 27, 2014
  7. Johan HerlandMar 27, 2014
  8. W. Trevor KingMar 28, 2014
  9. Junio C HamanoMar 27, 2014
  10. Jens LehmannMar 27, 2014
  11. W. Trevor KingMar 27, 2014
  12. Junio C HamanoMar 27, 2014
  13. Heiko VoigtMar 27, 2014
  14. Jens LehmannMar 27, 2014
  15. Johan HerlandMar 27, 2014
  16. W. Trevor KingMar 28, 2014
  17. [RFC] submodule: change submodule.<name>.branch default from master to HEADW. Trevor King, Mar 28, 2014
  18. Eric SunshineMar 28, 2014
  19. W. Trevor KingMar 28, 2014
  20. W. Trevor KingMar 28, 2014
  21. Jens LehmannMar 28, 2014
  22. W. Trevor KingMar 28, 2014
  23. Jens LehmannMar 31, 2014
  24. Junio C HamanoMar 28, 2014
  25. Jens LehmannMar 31, 2014
  26. W. Trevor KingMar 31, 2014
  27. Junio C HamanoMar 31, 2014
  28. submodule.<path>.branch vs. submodule.<name>.branch (was: Possible regression in master? (submodules without a "master" branch).W. Trevor King, Mar 27, 2014
  29. Junio C HamanoMar 27, 2014

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.