From: Sven Verdoolaege <skimo@kotnet.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Lars Hjemli <hjemli@gmail.com>
Subject: Re: [PATCH][RESEND] git-submodule: provide easy way of adding new submodules
Date: Sun, 24 Jun 2007 17:17:50 +0200 [thread overview]
Message-ID: <20070624151750.GA997MdfPADPa@greensroom.kotnet.org> (raw)
In-Reply-To: <7v8xaa4f5g.fsf@assigned-by-dhcp.pobox.com>
On Sat, Jun 23, 2007 at 12:58:03PM -0700, Junio C Hamano wrote:
> Somehow "git submodule add $URL $my_subdirectory" feels
> unnatural, although it certainly is simpler to write the command
The order of the arguments is the same as those of git-clone and
you can read it as "git: add submodule $URL (at) $my_subdirectory"
> usage string. Wouldn't a commit on the maintenance branch of
> cgit.git want to say "Add the 'maint' branch of git.git as my
> submodule", for example?
Sounds plausible
> The alternatives I can come up with do not feel right either, though.
>
> git submodule $my_subdirectory $URL [$branch]
> git submodule $URL [--branch $branch] $my_subdirectory
I'll add the latter, although it's not clear if you actually
want me to.
> > diff --git a/git-submodule.sh b/git-submodule.sh
> > index 89a3885..3df7121 100755
> > --- a/git-submodule.sh
> > +++ b/git-submodule.sh
> > @@ -1,13 +1,14 @@
> > #!/bin/sh
> > #
> > -# git-submodules.sh: init, update or list git submodules
> > +# git-submodules.sh: add, init, update or list git submodules
> > #
> > # Copyright (c) 2007 Lars Hjemli
> >
> > -USAGE='[--quiet] [--cached] [status|init|update] [--] [<path>...]'
> > +USAGE='[--quiet] [--cached] [add <repo>|status|init|update] [--] [<path>...]'
>
> Can a single repo added at more than one path with this syntax?
No. I was trying to be brief. The more correct syntax would be the one
in the documentation, but I thought that would be a bit lengthy for
USAGE.
> I've seen this code before elsewhere. We do not need to
> refactor right now with this patch, but please mark this copy
> with something like:
>
> # NEEDSWORK: identical function exists in get_repo_base
> # in clone.sh
> get_repo_base () {
> ...
OK
> > + test -e "$path" &&
> > + die "'$path' already exists"
> > +
> > + module_clone "$path" "$repo" || exit
>
> - module_clone catches the "$path already exists" case; but the
> test is done differently. One particular case of "an empty
> directory exists" is allowed there, but you are dying early
> to forbid it. Is that warranted? My gut feeling is that
> they should share the same check, iow, don't check yourself
> but have module_clone take care of the error case.
They're different because submodule update (which also calls module_clone)
is performed on a module that already exists in the repo and
was therefore checked out by git as an empty directory. If you
add a new submodule, then there is no reason for the subdirectory
to exist already.
> - If $path does not exist in the worktree (because it hasn't
> been checked out), but does exist in the index, what should
> happen? Should it be flagged as an error (in module_clone,
> not here)?
Good question. It should fail. However, I think this new check
does belong here, because when module_clone is called from
modules_update, the path _should_ exist in the index.
skimo
next prev parent reply other threads:[~2007-06-24 15:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-21 9:53 [PATCH][RESEND] git-submodule: provide easy way of adding new submodules Sven Verdoolaege
2007-06-23 19:26 ` Lars Hjemli
2007-06-23 20:15 ` Junio C Hamano
2007-06-23 19:58 ` Junio C Hamano
2007-06-24 15:17 ` Sven Verdoolaege [this message]
2007-06-24 17:50 ` Junio C Hamano
2007-06-24 21:06 ` [PATCH] " Sven Verdoolaege
2007-06-25 7:09 ` Junio C Hamano
2007-07-03 15:47 ` Sven Verdoolaege
2007-07-04 5:10 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070624151750.GA997MdfPADPa@greensroom.kotnet.org \
--to=skimo@kotnet.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hjemli@gmail.com \
--cc=skimo@liacs.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).