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

Re: [PATCH RESEND] git submodule add: make the <path> parameter optional

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 4, 2009, 21:05 UTC
Message-ID
<alpine.DEB.1.00.0910042304060.4985@pacific.mpi-cbg.de>
In-Reply-To
<4AC8E0A8.4000901@web.de>
Hi,
On Sun, 4 Oct 2009, Jens Lehmann wrote:
Show 56 quoted lines
> Junio C Hamano schrieb:
> > Jens Lehmann <Jens.Lehmann@web.de> writes:
> > 
> >> When <path> is not given, use the "humanish" part of the source repository
> >> instead.
> >>
> >> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
> >> ---
> >>
> >> With this patch, git submodule add behaves like git clone in this respect.
> >>
> >> Didn't get a response the last weeks, so here is a resend.
> >>
> >>
> >>  Documentation/git-submodule.txt |    8 ++++++--
> >>  git-submodule.sh                |    7 ++++++-
> >>  t/t7400-submodule-basic.sh      |   16 ++++++++++++++++
> >>  3 files changed, 28 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
> >> index 5ccdd18..4ef70c4 100644
> >> --- a/Documentation/git-submodule.txt
> >> +++ b/Documentation/git-submodule.txt
> >> @@ -10,7 +10,7 @@ SYNOPSIS
> >>  --------
> >>  [verse]
> >>  'git submodule' [--quiet] add [-b branch]
> >> -	      [--reference <repository>] [--] <repository> <path>
> >> +	      [--reference <repository>] [--] <repository> [<path>]
> >>  'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...]
> >>  'git submodule' [--quiet] init [--] [<path>...]
> >>  'git submodule' [--quiet] update [--init] [-N|--no-fetch] [--rebase]
> >> @@ -69,7 +69,11 @@ add::
> >>  	to the changeset to be committed next to the current
> >>  	project: the current project is termed the "superproject".
> >>  +
> >> -This requires two arguments: <repository> and <path>.
> >> +This requires at least one argument: <repository>. The optional
> >> +argument <path> is the relative location for the cloned submodule
> >> +to exist in the superproject. If <path> is not given, the
> >> +"humanish" part of the source repository is used ("repo" for
> >> +"/path/to/repo.git" and "foo" for "host.xz:foo/.git").
> > 
> > I do not know if this is useful in practice nor even desired.  Comments?
> 
> As nobody commented until now, i'll explain my motivation for this patch.
> 
> When adding submodules i was surprised to find that i had to explicitly
> provide the pathname even though it could be easily generated from the
> reponame as git clone does it. And i see git clone and git submodule add
> as related commands from a users perspective, they both connect a remote
> repo to a working directory.
> 
> IMHO this patch makes the ui more consistent and doesn't break existing
> setups or scripts. And it is really useful because i don't do typos in
> the pathname anymore ;-)

So far, I started submodules by cloning them, doing everything in the other files needed to integrate, and then actually wondered why "git submodule add" could not simply take the (relative) path to the checked-out submodule and deduce the URL from the corresponding config?

So I would actually vote for making the <repository> parameter optional...

Ciao, Dscho

Previous: Jens LehmannNext: Junio C Hamano
Message 4 of 7 in “git submodule add: make the <path> parameter optional”
  1. git submodule add: make the <path> parameter optionalJens Lehmann, Sep 22, 2009
  2. Junio C HamanoSep 22, 2009
  3. Jens LehmannOct 4, 2009
  4. Johannes SchindelinOct 4, 2009
  5. Junio C HamanoOct 5, 2009
  6. Johannes SchindelinOct 5, 2009
  7. Jens LehmannOct 5, 2009

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.