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

Re: [PATCH] Add git-submodule command

From
LHLars Hjemli <hjemli@gmail.com>
Date
May 25, 2007, 14:16 UTC
Message-ID
<8c5c35580705250716j27695a01kd1db222be6c7eac7@mail.gmail.com>
In-Reply-To
<Pine.LNX.4.64.0705251451530.4648@racer.site>
On 5/25/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 20 quoted lines
> On Fri, 25 May 2007, Lars Hjemli wrote:
> > On 5/25/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > > On Fri, 25 May 2007, Lars Hjemli wrote:
> > > > +             die "Unable to find current revision of submodule '$path'"
> > > > +
> > > > +             if test "$subsha1" != "$sha1"
> > > > +             then
> > > > +                     $(cd "$path" && git-fetch && git-checkout -q
> > > "$sha1") ||
> > >
> > > This will make a detached HEAD, right? Do you want that? (I am not
> > > really interested in submodules myself, so I haven't thought about it,
> > > and I haven't followed that monster discussion.)
> >
> > Well, we might want to be smarter about this, but on the other hand: if
> > the user cares, he can always do 'cd $path && git checkout $branch',
> > since 'git submodule -u' will skip submodules with the correct commit
> > checked out.
>
> Fair enough, I guess...

The only alternative I can think of is to check if module.$path.branch is specified in .gitmodules: if it is, and it's pointing at the wanted sha1, the right thing would be to checkout that branch. Any other sort of dwim is bound to get it wrong.

Show 14 quoted lines
>
> > > I'll let Junio comment on that command line parsing...
> >
> > Heh, I'm a shell illiterate...
>
> ;-)
>
> I guess Junio would like one of his famous
>
>         case ,"$init","$update",[...] in
>         *1*1) usage
>         esac
>
> to prevent running with two actions...
Ahh, that's something I can handle
Show 9 quoted lines
>
> > > All in all, I like it: it is short, to the point, and it should do the
> > > job (maybe with a few enhancements like "--update" without arguments
> > > means _all_ submodules).
> >
> > Well, it does (or should) update all initialized submodules, but maybe
> > that's not what you meant?
>
> Oops. I meant "init".

Hmm, it does (or should) clone all submodules if you run 'git submodule --init' (no paths specified). Did it fail for you?

-- 
larsh
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 6 of 26 in “Add git-submodule command”
  1. Add git-submodule commandLars Hjemli, May 25, 2007
  2. Johannes SchindelinMay 25, 2007
  3. Johannes SchindelinMay 25, 2007
  4. Lars HjemliMay 25, 2007
  5. Johannes SchindelinMay 25, 2007
  6. Lars HjemliMay 25, 2007
  7. Johannes SchindelinMay 25, 2007
  8. Lars HjemliMay 25, 2007
  9. Add git-submodule commandLars Hjemli, May 25, 2007
  10. Johannes SchindelinMay 25, 2007
  11. Junio C HamanoMay 25, 2007
  12. Lars HjemliMay 25, 2007
  13. Junio C HamanoMay 25, 2007
  14. Lars HjemliMay 25, 2007
  15. Add git-submodule commandLars Hjemli, May 26, 2007
  16. Johannes SchindelinMay 26, 2007
  17. Junio C HamanoMay 26, 2007
  18. Lars HjemliMay 26, 2007
  19. Johannes SchindelinMay 26, 2007
  20. Add git-submodule commandLars Hjemli, May 26, 2007
  21. Simon HausmannMay 26, 2007
  22. Lars HjemliMay 26, 2007
  23. Johannes SchindelinMay 25, 2007
  24. Linus TorvaldsMay 25, 2007
  25. Johannes SchindelinMay 25, 2007
  26. Lars HjemliMay 25, 2007

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.