Re: [PATCH] Add git-submodule command

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

 



Hi,

On Fri, 25 May 2007, Lars Hjemli wrote:

> On 5/25/07, Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote:
> > 
> > On Fri, 25 May 2007, Lars Hjemli wrote:
> > 
> > > +modules_init()
> > > +{
> > > +     git ls-files --stage -- $@ | grep -e '^160000 ' |
> > 
> > Any reason you read in the stage? It does not seem that you use it.
> 
> Are there any other way to get the mode info?

Ah, I missed that. Right.

> > > +             subsha1=$(cd "$path" && git-rev-parse --verify HEAD) ||
> > 
> > Maybe it would be a better idea to use "git --git-dir="$path" 
> > rev-parse ..."? Just in case somebody calls this with GIT_DIR 
> > overridden...
> > 
> > Or, unset GIT_DIR explicitely.
> 
> Hmm, that's annoying (overridden GIT_DIR). I guess 'git --git-dir 
> $path/.git' would be the easiest solution.

But you have to repeat it on every subsequent Git command. OTOH if you 
unset GIT_DIR, you can no longer be sure that you have the correct git dir 
for Git calls in the superproject...

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

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

> > 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". I mean, most people who want to clone a superproject 
want the submodules being initialized without hassles, probably. But maybe 
that should be another option: "--clone-superproject" or something. Dunno. 
There's time for that after the initial git-submodule.

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