git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jens Lehmann <Jens.Lehmann@web.de>
Cc: Marc Branchaud <marcnarc@xiplink.com>,
	git@vger.kernel.org, Mark Levedahl <mlevedahl@gmail.com>
Subject: Re: [PATCH] Clarified how "git submodule add" handles relative paths.
Date: Sun, 05 Jun 2011 11:27:36 -0700	[thread overview]
Message-ID: <7vipskb0br.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4DE93B29.4030401@web.de> (Jens Lehmann's message of "Fri, 03 Jun 2011 21:51:05 +0200")

Jens Lehmann <Jens.Lehmann@web.de> writes:

> Am 02.06.2011 19:14, schrieb Junio C Hamano:
>> I suspect that it would be a relatively easy fix if your toplevel
>> superproject is its own authoritative upstream.  Something along the line
>> of this patch, perhaps?  It is obviously untested, and we may want to
>> issue an "echo >&2 'info:...'" to tell the user what we are assuming in
>> this codepath.
>
> Maybe it is better to not automagically switch from "path is relative to
> url configured in superproject" to "path is relative to $(pwd)" depending
> on the presence or absence of a default remote in the superproject. When
> a user wants to set up his submodules relative to the superproject and
> simply did forget to configure the url of the superproject first he won't
> notice that anymore after this patch. But instead he will get a local
> submodule url only to find out later that this was not what I wanted (and
> an 'info' can easily be missed).

Sorry, I don't get this. The "how-about-this" patch was not about
"automagically switch depending on ...". Absense of the remote in the
superproject means that the project originates from here, iow, it is its
own "origin" (that is your third use case).

I think I understand the scenario you are worried about; let me illustrate
to make sure I got it right:

 1. You are starting your project that will have subproject locally. You do
    not have "origin" yet.

 2. You create a subproject "xyzzy", still locally, and add it with
    "submodule add ./xyzzy" with a relative URL.

 3. You will deploy your superproject and subproject at "git://host.xz/mine/"
    and "git://host.xz/mine/xyzzy", respectively.

 4. But because in step 2. your .git/config is already set up to point
    your local $(pwd)/xyzzy as the submodule location. This is not what
    you want and you may not notice it.

Is that the problem you are worried about? If so, I think you are solving
it in a wrong way.

By not allowing a relative path, in step 2. you would entice the user to
say "submodule add $(pwd)/xyzzy" (as there is no final upstream location
yet), no? If the project is going to be eventually published at a
different location, not just .git/config but .gitmodules also needs to be
updated as part of step 3. Isn't that going backwards?  If you allow the
user to say "./xyzzy" in step 2., the .gitmodules entry can stay the same
from the get-go.

If you think about "absense of the remote in the superproject means the
project originates from here", what you are doing in step 3. is to
changing the origin of these set of projects. After changing the origin of
these set of projects, isn't "git submodule sync" an established way to
adjust to the change? I was hoping that that would update .git/config in
step 3. so you wouldn't have the problem in step 4. at all.

It is likely I am missing something in the above analysis. Please correct
me.

Thanks.

  parent reply	other threads:[~2011-06-05 18:27 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-30 21:51 [PATCH 0/2] Tests for some submodule corner cases Marc Branchaud
2011-05-30 21:51 ` [PATCH 1/2] Added a test for "submodule add" using a ../relative/path/to/the/submodule/repo Marc Branchaud
2011-05-30 21:51 ` [PATCH 2/2] Added a test for "submodule status" when the submodule's working directory has deleted files Marc Branchaud
2011-05-31 19:30 ` [PATCH 0/2] Tests for some submodule corner cases Jens Lehmann
2011-05-31 20:00   ` [PATCH] submodule add: improve message when resolving a relative url fails Jens Lehmann
2011-05-31 20:57     ` Marc Branchaud
2011-05-31 21:34       ` [PATCH v2] " Jens Lehmann
2011-05-31 22:04       ` [PATCH] " Phil Hord
2011-06-01 15:55         ` Marc Branchaud
2011-07-27 19:00           ` Phil Hord
2011-07-29 20:10             ` Marc Branchaud
2011-05-31 23:23       ` Junio C Hamano
2011-06-01 15:56         ` [PATCH] Clarified how "git submodule add" handles relative paths Marc Branchaud
2011-06-01 16:59           ` Junio C Hamano
2011-06-01 19:55             ` Jens Lehmann
2011-06-02 17:14               ` Junio C Hamano
2011-06-03 19:51                 ` Jens Lehmann
2011-06-03 23:16                   ` Junio C Hamano
2011-06-04  2:23                     ` Mark Levedahl
2011-06-04 15:39                       ` Jens Lehmann
2011-06-04 16:19                     ` Jens Lehmann
2011-06-05 18:27                   ` Junio C Hamano [this message]
2011-06-06 19:56                     ` [PATCH 0/3] submodule add: allow relative repository path even when no url is set Jens Lehmann
2011-06-06 19:57                       ` [PATCH 1/3] submodule add: test failure when url is not configured in superproject Jens Lehmann
2011-06-06 19:58                       ` [PATCH 2/3] submodule add: allow relative repository path even when no url is set Jens Lehmann
2011-06-06 20:49                         ` [PATCH 0/2] Improve "git submodule add" documentation Marc Branchaud
2011-06-06 20:49                           ` [PATCH 1/2] More precisely described how "git submodule add" handles relative submodule URLs Marc Branchaud
2011-06-06 20:49                           ` [PATCH 2/2] Moved paragraph describing the utility of " Marc Branchaud
2011-06-06 19:58                       ` [PATCH 3/3] submodule add: clean up duplicated code Jens Lehmann
2011-06-06 21:00                       ` [PATCH 0/3] submodule add: allow relative repository path even when no url is set Junio C Hamano
2011-06-06 21:23                         ` Marc Branchaud
2011-06-06 21:39                           ` Jens Lehmann
2011-06-07 21:03                           ` Jens Lehmann
2011-06-08 13:16                             ` Phil Hord
2011-06-02 14:21             ` [PATCHv2] Clarified how "git submodule add" handles relative paths Marc Branchaud
2011-05-31 21:06   ` [PATCH 0/2] Tests for some submodule corner cases Marc Branchaud
2011-05-31 21:26     ` Jens Lehmann
2011-06-01 16:11       ` Marc Branchaud
2011-06-01 17:44         ` Junio C Hamano
2011-06-01 19:26         ` Jens Lehmann

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=7vipskb0br.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=marcnarc@xiplink.com \
    --cc=mlevedahl@gmail.com \
    /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).