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
Stefan Beller <sbeller@google.com>
Date
Sep 15, 2016, 18:15 UTC
Message-ID
<CAGZ79kbYEqbr0h_0U=Ed-NRrsjb4XmznL8C45gTyJCVx+X-LTQ@mail.gmail.com>
In-Reply-To
<xmqqwpidniry.fsf@gitster.mtv.corp.google.com>
On Thu, Sep 15, 2016 at 11:02 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
> I think that is a more pressing thing to address.  Once we make it
> easier for the user to bring a half-initialized submodule properly
> into the world view of the submodule subsystem, we would have to
> worry about the reported failure case even less and you do not need
> to pile on workaround options to let things continue in a state that
> is half-broken (that is, in a state that is perfectly sane to the
> core layer, but is not liked by the submodule layer).
Heh, I see.
    When searching around the net, some people use half
    initialized submodules intentionally, e.g. I'll store some private keys in
    sub and I publish the superproject asking for collaborators to my new shiny
    webbased thing. The submodule containing the private keys never leaves
    my hard drive, hence no .gitmodules entry is necessary.
Not sure I agree with such a setup, but people use it.
So how about this fictional work flow:
         $ git init top
         $ cd top
         $ git commit --allow-empty -m 'initial in top'
         $ git init sub
         $ git -C sub commit --allow-empty -m 'initial in sub'
         $ git add sub
        You added a gitlink, but no corresponding entry in
        .gitmodules is found. This is fine for gits core functionality, but
        the submodule command gets confused by this unless you add 'sub'
        to your .gitmodules via `git submodule add --already-in-tree \
        --reuse-submodules-origin-as-URL sub`. Alternatively you can make this
        message disappear by configuring advice.gitlinkPitfalls.
         $ git submodule
         ... similar advice goes here...
         fatal: no submodule mapping found in .gitmodules for path 'sub'
         $ git submodule add --fixup-modules-file ./sub sub
         Adding .gitmodule entry only for `sub` to use `git -C remote
show origin` as URL.
         # user is happy now.
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 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.