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