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

Re: [wishlist?] make submodule commands robust to having non-submodule Subprojects

From
Jacob Keller <jacob.keller@gmail.com>
Date
Sep 16, 2016, 15:40 UTC
Message-ID
<CA+P7+xpyZWqyqnNLaheU=bmyCr3wYFFO3XXKCf56E1-_-sFRAA@mail.gmail.com>
In-Reply-To
<20160916141143.GA47240@book.hvoigt.net>
On Fri, Sep 16, 2016 at 7:11 AM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
Show 33 quoted lines
> How about just
>
>    git submodule add <submodulepath>
>
> ? I remember back in the days when I started with submodules thats the
> way I imagined submodules would work:
>
> 1. clone the submodule into a directory
> 2. git submodule add it
> 3. git commit everything
>
> Because that how you basically work with files.  So instead of adding
> another option I would rather like to autodetect that:
>
>  * its a relative path inside this repo that is passed to
>    'git submodule add'
>  * there is no .gitmodules entry
>  * and no .git/config
> ==> create those from a remote in the submodule
>
> Corner cases:
>
>  * If there is more than one remote we could tell the user to use an
>    option to specify which one to use.
>  * Barf in case there is no remote (not adding the submodule except -f
>    is used).
>  * If the gitlink is already there but no .gitmodules entry, 'git
>    submodule add' will just add the entry as if it was initially added.
>
> Instead of giving an error message that the submodule is already added
> we could actually be nicer to the user and try to fix things for him
> instead.
>

This makes sense to me. Possibly we could warn in this case, so that the user knows that something was "off" but I don't think we should be failing here...

Regards, Jake

> Cheers Heiko
Previous: Heiko VoigtNext: Junio C Hamano
Message 12 of 13 in “[wishlist?] make submodule commands robust to having non-submodule Subprojects”
  1. Yaroslav HalchenkoSep 15, 2016
  2. Stefan BellerSep 15, 2016
  3. Yaroslav HalchenkoSep 15, 2016
  4. Stefan BellerSep 15, 2016
  5. Junio C HamanoSep 15, 2016
  6. Yaroslav HalchenkoSep 15, 2016
  7. Stefan BellerSep 15, 2016
  8. Junio C HamanoSep 15, 2016
  9. Stefan BellerSep 15, 2016
  10. Junio C HamanoSep 15, 2016
  11. Heiko VoigtSep 16, 2016
  12. Jacob KellerSep 16, 2016
  13. Junio C HamanoSep 16, 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.