Re: [PATCH] Add git-submodule command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, 25 May 2007, Junio C Hamano wrote:

> Lars Hjemli <hjemli@xxxxxxxxx> 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:

> 
> > +	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.

> > +		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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux