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

Re: [PATCH] submodule: no [--merge|--rebase] when newly cloned

From
Jens Lehmann <jens.lehmann@web.de>
Date
Feb 16, 2011, 20:10 UTC
Message-ID
<4D5C2F33.8020309@web.de>
In-Reply-To
<7v62sjkbbi.fsf@alter.siamese.dyndns.org>
Am 16.02.2011 20:51, schrieb Junio C Hamano:
Show 9 quoted lines
> "Spencer E. Olson" <olsonse@umich.edu> writes:
> 
>> Previously, when a submodule was cloned in the same command execution, --rebase
>> or --merge would attempt to run (instead of and) before a checkout, resulting in
>> an empty working directory.  This patch ignores --rebase or --merge for a
>> particular submodule when that submodule is newly cloned and instead simply
>> checks out the appropriate revision.
> 
> Sorry, but I cannot parse the problem description, "(instead of and)" part.

I think what he wanted to say was that after a new submodule is cloned by running "git submodule update" it will attempt to do a rebase or merge without having checked out the submodule at all, which obviously can't work. A plain checkout looks like the right thing to do, as there aren't any local commits to rebase or merge yet.

> Why is it a better thing to do to ignore these options, instead of
> detecting the situation and error it out, saying "you are initially
> cloning, don't say --rebase"?

It should be fine to use these options when new submodules appear. (And even without explicitly specifing these command line options this bug can also be triggered by having the "submodule.<name>.update" option set in .gitmodules to either "rebase" or "merge", which is easy to miss)

So this looks like a worthwhile fix. The commit message and POSIX issue need to be addressed, tests would be a good thing to add too, but apart from that it looks sane.

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 9 in “submodule: no [--merge|--rebase] when newly cloned”
  1. submodule: no [--merge|--rebase] when newly clonedSpencer E. Olson, Feb 16, 2011
  2. Junio C HamanoFeb 16, 2011
  3. Jens LehmannFeb 16, 2011
  4. Junio C HamanoFeb 16, 2011
  5. Spencer E. OlsonFeb 17, 2011
  6. Johannes SixtFeb 17, 2011
  7. Martin von ZweigbergkFeb 18, 2011
  8. Spencer E. OlsonFeb 18, 2011
  9. Martin von ZweigbergkFeb 18, 2011

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.