git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Keeping <john@keeping.me.uk>
To: Heiko Voigt <hvoigt@hvoigt.net>
Cc: Jens Lehmann <Jens.Lehmann@web.de>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: Re: Re: What's cooking in git.git (May 2013, #09; Wed, 29)
Date: Tue, 4 Jun 2013 13:48:26 +0100	[thread overview]
Message-ID: <20130604124826.GN1072@serenity.lan> (raw)
In-Reply-To: <20130604111717.GA306@book.hvoigt.net>

On Tue, Jun 04, 2013 at 09:17:17PM +1000, Heiko Voigt wrote:
> On Tue, Jun 04, 2013 at 09:10:45AM +0100, John Keeping wrote:
> > On Tue, Jun 04, 2013 at 03:29:51PM +1000, Heiko Voigt wrote:
> > > On Mon, Jun 03, 2013 at 11:23:41PM +0100, John Keeping wrote:
> > > > > Sorry, I should have been more specific here. I saw that you did some
> > > > > changes to make "submodule add" do the right thing with relative paths,
> > > > > but the following change to t7406 does not work like I believe it
> > > > > should but instead makes the test fail:
> > > > > -------------------8<---------------------
> > > > > diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
> > > > > index a4ffea0..9766b9e 100755
> > > > > --- a/t/t7406-submodule-update.sh
> > > > > +++ b/t/t7406-submodule-update.sh
> > > > > @@ -559,7 +559,9 @@ test_expect_success 'add different submodules to the same pa
> > > > >  test_expect_success 'submodule add places git-dir in superprojects git-dir' '
> > > > >         (cd super &&
> > > > >          mkdir deeper &&
> > > > > -        git submodule add ../submodule deeper/submodule &&
> > > > > +        (cd deeper &&
> > > > > +         git submodule add ../../submodule submodule
> > > > > +        ) &&
> > > > >          (cd deeper/submodule &&
> > > > >           git log > ../../expected
> > > > >          ) &&
> > > > > -------------------8<---------------------
> > > > 
> > > > Ah, ok.  I think this case is problematic because the repository
> > > > argument is either relative to "remote.origin.url" or to the top of the
> > > > working tree if there is no "origin" remote.  I wonder if we should just
> > > > die when a relative path is given for the repository and we're not at
> > > > the top of the working tree.
> > > 
> > > Why not behave as if we are at the top of the working tree for relative
> > > paths? If there is an origin remote thats fine. If there is no origin
> > > remote you could warn that the path used is taken relative from the root
> > > of the superproject during add. What do you think?
> > 
> > That's what the patch currently queued on "pu" does, which Jens wants to
> > change, isn't it?
> 
> True I did not realize this when reading it the first time. But I think
> we should still not die when in a subdirectory. After all this series is
> trying to archive that the submodule command works in subdirectories
> seamlessly right? So you probably want to translate a relative path
> without "origin" remote given from a subdirectory to the superproject
> level and use that. Then you do not have to die.

The problem is that sometimes you do want to adjust the path and
sometimes you don't.  Reading git-submodule(1), it says:

     This may be either an absolute URL, or (if it begins with ./ or
     ../), the location relative to the superproject’s origin
     repository.
     [snip]
     If the superproject doesn’t have an origin configured the
     superproject is its own authoritative upstream and the current
     working directory is used instead.

So I think it's quite reasonable to have a server layout that looks like
this:

    project
    |- libs
    |  |- libA
    |  `- libB
    |- core.git

and with only core.git on your local system do:

    cd core/libs
    git submodule add ../libs/libB

expecting that to point to libB.  But if we adjust the path then the
user has to do:

    git submodule add ../../libs/libB

However, it is also perfectly reasonable to have no remote configured
and the library next to the repository itself.  In which case we do want
to specify the additional "../" so that shell completion works in the
natural way.

The only way I can see to resolve the ambiguity is to die when we hit
this particular case.  This should be acceptable because people
shouldn't be adding new submodules anywhere near as often as they
perform other submodule operations and it doesn't affect absolute URLs.

  reply	other threads:[~2013-06-04 12:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-29 23:58 What's cooking in git.git (May 2013, #09; Wed, 29) Junio C Hamano
2013-05-30  9:47 ` Thomas Rast
2013-05-30  9:56   ` Ramkumar Ramachandra
2013-06-02 23:44   ` Junio C Hamano
2013-05-30 19:18 ` Jens Lehmann
2013-06-02 18:50   ` Junio C Hamano
2013-06-03 21:27     ` Jens Lehmann
2013-07-01 22:05       ` Junio C Hamano
2013-05-30 19:23 ` Jens Lehmann
2013-05-31 19:40   ` John Keeping
2013-06-03 14:54     ` John Keeping
2013-06-03 15:30       ` Junio C Hamano
2013-06-03 21:47     ` Jens Lehmann
2013-06-03 22:23       ` John Keeping
2013-06-04  5:29         ` Heiko Voigt
2013-06-04  8:10           ` John Keeping
2013-06-04 11:17             ` Heiko Voigt
2013-06-04 12:48               ` John Keeping [this message]
2013-06-04 21:39                 ` Jens Lehmann
2013-06-04 22:04                   ` John Keeping
2013-06-04 22:57                 ` Re: " Phil Hord
2013-06-05  8:19                   ` John Keeping
2013-05-31  6:16 ` Øystein Walle

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=20130604124826.GN1072@serenity.lan \
    --to=john@keeping.me.uk \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hvoigt@hvoigt.net \
    /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).