All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Heiko Voigt <hvoigt@hvoigt.net>
Cc: Stefan Beller <sbeller@google.com>,
	Yaroslav Halchenko <yoh@onerussian.com>,
	"git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [wishlist?] make submodule commands robust to having non-submodule Subprojects
Date: Fri, 16 Sep 2016 11:28:51 -0700	[thread overview]
Message-ID: <xmqqwpibk8bg.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160916141143.GA47240@book.hvoigt.net> (Heiko Voigt's message of "Fri, 16 Sep 2016 16:11:43 +0200")

Heiko Voigt <hvoigt@hvoigt.net> writes:

> On Thu, Sep 15, 2016 at 11:27:54AM -0700, Junio C Hamano wrote:
>
>> If the trend in Git community collectively these days is to make
>> usage of submodules easier and smoother, I'd imagine that you would
>> want to teach "git add" that was given a submodule to "git submodule
>> add" instead by default, with an option "git add --no-gitmodules
>> sub" to disable it, or something like that.
>> 
>> >          $ git submodule add --fixup-modules-file ./sub sub
>> >          Adding .gitmodule entry only for `sub` to use `git -C remote
>> > show origin` as URL.
>> 
>> I agree that a feature like this is needed regardless of what
>> happens at "git add" time.
>
> How about just
>
>    git submodule add <submodulepath>

When I said "a feature like this is needed", I didn't care about
exact syntax.  I am not sure how often people need the "fixup", what
kind of causes there are that they need the "fixup", and what the
distribution of vaious causes would be like.  If the _ONLY_ kind of
fixup necessary is "I meant to say 'git submodule add ./path path'
but I said 'git add path' instead", then I think it makes sense to
teach "submodule add" that the form "git submodule add <path>" is a
short-pand for "git submodule add ./<path> <path>".  I am not sure
if we want to _ignore_ a gitlink that is already in the index
unconditionally, i.e. if it is a good idea to let the second one
override the first one

	git submodule add $URL sub &&
        git submodule add sub

in this sequence, though.

> ? I remember back in the days when I started with submodules thats the
> way I imagined submodules would work:
>
> 1. clone the submodule into a directory
> 2. git submodule add it
> 3. git commit everything
>
> Because that how you basically work with files.  So instead of adding
> another option I would rather like to autodetect that:
>
>  * its a relative path inside this repo that is passed to
>    'git submodule add'
>  * there is no .gitmodules entry
>  * and no .git/config
> ==> create those from a remote in the submodule

In other words, I agree with the general direction but I'd add
another condition to the above three, i.e.

   * and there is no gitlink for that path in the index yet.


      parent reply	other threads:[~2016-09-16 18:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-15 13:02 [wishlist?] make submodule commands robust to having non-submodule Subprojects Yaroslav Halchenko
2016-09-15 16:05 ` Stefan Beller
2016-09-15 16:40   ` Yaroslav Halchenko
2016-09-15 17:29     ` Stefan Beller
2016-09-15 18:02   ` Junio C Hamano
2016-09-15 18:12     ` Yaroslav Halchenko
2016-09-15 18:16       ` Stefan Beller
2016-09-15 18:29       ` Junio C Hamano
2016-09-15 18:15     ` Stefan Beller
2016-09-15 18:27       ` Junio C Hamano
2016-09-16 14:11         ` Heiko Voigt
2016-09-16 15:40           ` Jacob Keller
2016-09-16 18:28           ` Junio C Hamano [this message]

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=xmqqwpibk8bg.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=hvoigt@hvoigt.net \
    --cc=sbeller@google.com \
    --cc=yoh@onerussian.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.