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

Re: [PATCH] Add git-submodule command

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 26, 2007, 10:42 UTC
Message-ID
<Pine.LNX.4.64.0705261136590.4648@racer.site>
In-Reply-To
<7v1wh4ped4.fsf@assigned-by-dhcp.cox.net>
Hi,
On Fri, 25 May 2007, Junio C Hamano wrote:
Show 18 quoted lines
> Lars Hjemli <hjemli@gmail.com> writes:
> 
> > +
> > +#
> > +# Run clone + checkout on missing submodules
> > +#
> > +# $@ = requested paths (default to all)
> > +#
> > +modules_init()
> > +{
> > +	git ls-files --stage -- $@ | grep -e '^160000 ' |
> 
> Did you mean "$@", i.e. inside double-quotes?
> 
> Because this pattern would appear a lot in superproject support,
> it might be a good idea to give a new option, --subprojects, to
> git-ls-files to limit its output to 160000 entries, but that is
> a minor detail.
I think that makes sense. It would also help the next one:
Show 8 quoted lines
> 
> > +	while read mode sha1 stage path
> > +	do
> 
> We would need to undo the shell-safety "quoted" output of paths
> here.  I suspect it would be much easier to code this in Perl or
> Python, do the "grep -e" part above in the script, when we start
> caring about unwrapping c-quoting of path (or "ls-files -z").

I would prefer this to be in shell... so to be easier make it a builtin later, when the script has evolved into a stable state. By introducing --subprojects to git-ls-files, you can roll your own quoting just for git-submodule, as needed.

> But that is a minor detail we could fix up later.
I agree. It makes for a nice incremental patch.
Show 10 quoted lines
> > +		test -d "$path/.git" && continue
> > +
> > +		if test -d "$path"
> > +		then
> > +			rmdir "$path" 2>/dev/null ||
> > +			die "Directory '$path' exist, but not as a submodule"
> > +		fi
> 
> Could the currently checked-out $path be a symlink to another
> directory, and what does the code do in such a case?

I am not quite sure if you should allow that... So, IMHO this is stuff to discuss after the initial revision (and after we have a test case, so we can play around with symlinks safely).

Ciao, Dscho

Previous: Lars HjemliNext: Lars Hjemli
Message 19 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.