All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Herland <johan@herland.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>, git@vger.kernel.org
Subject: Re: [PATCH 0/5] Fix 'url.*.insteadOf' for submodule URLs
Date: Mon, 04 Aug 2008 09:52:10 +0200	[thread overview]
Message-ID: <200808040952.10472.johan@herland.net> (raw)
In-Reply-To: <7vwsix5y9w.fsf@gitster.siamese.dyndns.org>

On Monday 04 August 2008, Junio C Hamano wrote:
> Johan Herland <johan@herland.net> writes:
> > 1. Consistency: Other git commands in the supermodule does _not_
> > require the URL rewriting rule to reside in the global config. Why
> > should 'git submodule' be different.
>
> When it comes to "submodules", I do not think such consistency argument
> makes much sense.  "git submodule" command crosses module boundary,
> normal commands don't.  They are naturally different and they should be.
>
> Your kind of consistency means breaking the separation between module
> boundary, doesn't it?

To a certain degree, yes, but (1) only for this specific config rule 
(url.*.insteadOf), and (2) only at the specific point in time when the 
submodule is cloned. This means that after the submodule is cloned, it is 
indeed not affected by the super-repo's config. E.g. you can change the 
origin URL of the submodule back to the original (un-rewritten) URL in the 
submodule's config, and the super-repo will not try to rewrite it at again.

I believe that the module boundary should not be crossed in general. But 
this patch only "crosses" that boundary before it really exists (i.e. 
before the submodule has been cloned into the super-repo). The event of 
introducing a submodule into a super-repo, is AFAICS the _only_ event where 
I would consider to cross the module boundary (and then only for a good 
reason).

> Having said that...
>
> > 2. I believe there are valid use cases for adding URL rewriting rules
> > to the repo config instead of the global config. You may want to check
> > out Fred's version of project X (including submodules), without making
> > your other clones of project X start cloning/fetching from Fred.
>
> I think you are referring to the example given in an earlier thread to
> peek what your neighbor did between you two, without affecting other
> people.

Correct.

> Personally I think it is partly showing the shortcoming of the current
> "git submodule" that minimally supports the workflow to follow what the
> canonical repository does, and partly showing that it is an abuse of that
> interface to rewrite config file to temporarily switch to peek somewhere
> else in such a workflow.

Indeed. However, the development of submodules usability seems so slow that 
even though this use case is an ugly workaround, it's one I thought we'd 
have to live with for some time... [1]

> Let's step back and think what we would do if there is no submodule
> involved.  That is, you usually follow origin, but you temporarily want
> to peek at what Fred did.  How would you do this?
>
> 	$ git fetch $fred $branch_fred_wants_you_to_review
> 	$ git checkout FETCH_HEAD ;# this detaches HEAD.
>
> And you take a look around.  Perhaps you like the change and decide to
> merge that to your branch.  Perhaps you create your own branch on top of
> that state, build a few fix-up commits, and give the result back to Fred.
>
> Shouldn't peeking what Fred did in the whole submodule hierarchy be
> essentially the same thing?  That is,
>
> 	$ git submodule for-each-submodule sh -c '
> 		git fetch "$fred/$1" $branch_fred_wants_you_to_review &&
> 		git checkout FETCH_HEAD
> 	' -
>
> where "for-each-submodule" would iterate over the submodules in the
> current superproject that you are interested in (that is, you actually
> have corresponding repositories there), and runs any given command with
> the path to the submodule in that directory.
>
> Hmm?

Yes, having such functionality in 'git submodule' would be wonderful. 
However, implementations of such functionality have been slow in coming, 
and apparently hard to implement without being workflow-agnostic (if I 
remember correctly).

In light of improvements to 'git submodule', feel free to disregard my patch 
series (although I still find 'git config --rewrite-url' useful for 
dry-testing my 'url.*.insteadOf' rules...).


Thanks for providing constructive feedback.


Have fun!

...Johan


[1]: Maybe 'git submodule' would improve more quickly if we ate our own 
dogfood, i.e. if we included submodules (e.g. gitk and git-gui) in git.git?

-- 
Johan Herland, <johan@herland.net>
www.herland.net

  reply	other threads:[~2008-08-04  8:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-03 22:57 [PATCH 0/5] Fix 'url.*.insteadOf' for submodule URLs Johan Herland
2008-08-03 23:00 ` [PATCH 1/5] Add testcase for 'git submodule' with url.*.insteadOf set in the super-repo Johan Herland
2008-08-03 23:04   ` [PATCH 1/5 v2] " Johan Herland
2008-08-03 23:01 ` [PATCH 2/5] Teach 'git config' to rewrite URLs according to current url.*.insteadOf rules Johan Herland
2008-08-03 23:02 ` [PATCH 3/5] Add selftest for new option '--rewrite-url' to 'git config' Johan Herland
2008-08-03 23:02 ` [PATCH 4/5] Add documentation on the new --rewrite-url option " Johan Herland
2008-08-03 23:02 ` [PATCH 5/5] Teach 'git submodule' to rewrite submodule URLs according to super-repo's rules Johan Herland
2008-08-03 23:27 ` [PATCH 0/5] Fix 'url.*.insteadOf' for submodule URLs Johannes Schindelin
2008-08-03 23:47   ` Johan Herland
2008-08-04  2:06     ` Junio C Hamano
2008-08-04  7:52       ` Johan Herland [this message]
2008-08-03 23:57   ` 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=200808040952.10472.johan@herland.net \
    --to=johan@herland.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.