git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Lars Hjemli" <hjemli@gmail.com>
To: "Junio C Hamano" <junkio@cox.net>
Cc: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	git@vger.kernel.org,
	"Linus Torvalds" <torvalds@linux-foundation.org>
Subject: Re: [PATCH] Add git-submodule command
Date: Fri, 25 May 2007 22:29:41 +0200	[thread overview]
Message-ID: <8c5c35580705251329u33ac1462m9db35cac0c37e3a9@mail.gmail.com> (raw)
In-Reply-To: <7vodk8r97s.fsf@assigned-by-dhcp.cox.net>

On 5/25/07, Junio C Hamano <junkio@cox.net> wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > On Fri, 25 May 2007, Lars Hjemli wrote:
> >
> >> Btw: testing this quickly becomes tedious, so I'll try to make a proper
> >> testscript later tonight.
> >
> > Very good.
> >
> >> +'git-submodule' [--init | --update | --cached] [--quiet] [--] [<path>...]
> >
> > I did not realize this earlier, but we seem to have more and more programs
> > where actions are specified without "--", i.e. "git-svn fetch", or
> > "git-bundle create".
> >
> > I actually like that, to separate actions from options. Hmm?
>
> I think it is a sensible thing to do for this kind of "wrapper
> of different functionalities related to one area".

Ok, there seems to be general agreement on this, so how about
something like this instead:

  git-submodule [--quiet] [--cached] [init | update] [--] [<path>...]

or would you rather have

  git-submodule [--quiet] [--cached] <cmd> [<path>...]

with cmd being one of init, update, status?

> >> +FILES
> >> +-----
> >> +When cloning submodules, a .gitmodules file in the top-level directory
> >> +of the containing work-tree is examined for the url of each submodule.
> >> +The url is the value of the key module.$path.url.
> >
> > IIRC Junio talked about a name for overriding. But I think it would be
> > even better to to override by mapping the URLs from .gitmodules to the
> > locally-wanted URLs.
> >
> > Junio?
>
> I really do not want that (mis)conception that .gitmodules
> specify the default and .git/config the override.  I really
> think we should use the .git/config as _the_ only authority to
> get URL, but keyed with the three-level scheme, with URL in
> .gitmodules used _solely_ as a hint when setting up the URL in
> the .git/config file.
>
>         cf. $gmane/47502, 47548, 47621
>

I've read these articles, but I think much of the concerns about
trusting the url supplied by upstream goes away when the submodule
clone/checkout isn't an integrated part of the superproject
clone/checkout. Besides, if you trust your upstream enough to clone
their repository (the superproject), why wouldn't you trust the data
(.gitmodules) in that very repository?

Still, a way to locally override the suggested url is probably needed.
 This can be easily achieved by either yours or Linus' suggestion
about 'url rewriting'. And if clone/checkout doesn't touch the
submodules at all, the downstream user can look at/override the
.gitmodules file in his local tree before deciding to do the submodule
 clone or checkout. I don't think there is any need for an interactive
tool here.

Another possibility is simply doing the submodule clone/checkout by
hand (i.e. do 'git clone preferred-url path', don't do 'git submodule
init path').


> >> +When updating submodules, the same .gitmodules file is examined for a key
> >> +named 'module.$path.branch'. If found, and if the named branch is currently
> >> +at the same revision as the commit-id in the containing repositories index,
> >> +the specified branch will be checked out in the submodule. If not found, or
> >> +if the branch isn't currently positioned at the wanted revision, a checkout
> >> +of the wanted sha1 will happen in the submodule, leaving its HEAD detached.
> >
> > A very good description, and I think this is the only method to checkout
> > the submodule which makes sense. (Just maybe default the value of
> > module.<path>.branch to "master"?)
>
> I suspect leaving the HEAD always detached if the superproject
> tree names a concrete commit object name would be less confusing
> and consistent.

And easier to explain :)


>When the name of the commit object in the
> superproject tree and/or index is 0{40}, it would be a good
> extension to use "whatever commit that happens to be at the tip
> of this branch" taken from the .gitmodules file.
>

I really can't imagine what kind of superproject would have such a
setup. Why would this be needed?

-- 
larsh

  reply	other threads:[~2007-05-25 20:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-25  9:51 [PATCH] Add git-submodule command Lars Hjemli
2007-05-25 10:57 ` Johannes Schindelin
2007-05-25 12:24 ` Johannes Schindelin
2007-05-25 13:46   ` Lars Hjemli
2007-05-25 13:58     ` Johannes Schindelin
2007-05-25 14:16       ` Lars Hjemli
2007-05-25 14:47         ` Johannes Schindelin
2007-05-25 14:52           ` Lars Hjemli
2007-05-25 18:09             ` Lars Hjemli
2007-05-25 18:41               ` Johannes Schindelin
2007-05-25 19:31                 ` Junio C Hamano
2007-05-25 20:29                   ` Lars Hjemli [this message]
2007-05-25 20:52                     ` Junio C Hamano
2007-05-25 22:01                       ` Lars Hjemli
2007-05-26  0:17                         ` Lars Hjemli
2007-05-26  0:48                           ` Johannes Schindelin
2007-05-26  1:23                           ` Junio C Hamano
2007-05-26  9:39                             ` Lars Hjemli
2007-05-26 10:42                             ` Johannes Schindelin
2007-05-26 13:56                             ` Lars Hjemli
2007-05-26 14:37                               ` Simon Hausmann
2007-05-26 14:48                                 ` Lars Hjemli
2007-05-25 20:30                   ` Johannes Schindelin
2007-05-25 19:57                 ` Linus Torvalds
2007-05-25 20:28                   ` Johannes Schindelin
2007-05-25 22:33                 ` Lars Hjemli

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=8c5c35580705251329u33ac1462m9db35cac0c37e3a9@mail.gmail.com \
    --to=hjemli@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=torvalds@linux-foundation.org \
    /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).