All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Voigt <hvoigt@hvoigt.net>
To: Stefan Beller <sbeller@google.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Jeff King <peff@peff.net>
Subject: Re: [PATCH 1/2] submodule add: extend force flag to add existing repos
Date: Tue, 11 Oct 2016 18:36:47 +0200	[thread overview]
Message-ID: <20161011163647.GA78554@book.hvoigt.net> (raw)
In-Reply-To: <CAGZ79kbg1KaeL14DMcV=ObaZOBpJpxOZAEYY1mmf8eqDUUqYmA@mail.gmail.com>

Hi,

On Fri, Oct 07, 2016 at 10:25:04AM -0700, Stefan Beller wrote:
> On Fri, Oct 7, 2016 at 5:52 AM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
> > On Thu, Oct 06, 2016 at 01:11:20PM -0700, Junio C Hamano wrote:
> >> Stefan Beller <sbeller@google.com> writes:
> >>
> >> > Currently the force flag in `git submodule add` takes care of possibly
> >> > ignored files or when a name collision occurs.
> >> >
> >> > However there is another situation where submodule add comes in handy:
> >> > When you already have a gitlink recorded, but no configuration was
> >> > done (i.e. no .gitmodules file nor any entry in .git/config) and you
> >> > want to generate these config entries. For this situation allow
> >> > `git submodule add` to proceed if there is already a submodule at the
> >> > given path in the index.
> >
> > Is it important that the submodule is in the index?
> 
> If it is not in the index, it already works.

Ah ok I was not aware of that, sorry.

> > How about worktree?
> > From the index entry alone we can not deduce the values anyway.
> 
> Right, but as of now this is the only show stopper, i.e.
> * you have an existing repo? -> fine, it works with --force
> * you even ignored that repo -> --force knows how to do it.
> * you already have a gitlink -> Sorry, you're out of luck.
> 
> So that is why I stressed index in this commit message, as it is only about this
> case.

Forget what I wrote. As said above I was not aware that there is only an
error when it is already in the index.

> > [1] http://public-inbox.org/git/%3C20160916141143.GA47240@book.hvoigt.net%3E/
> 
> Current situation:
> 
> > clone the submodule into a directory
> > git submodule add --force
> > git commit everything
> 
> works fine, but:
> 
> > clone the submodule into a directory
> > git add <gitlink>
> > git commit <gitlink> -m "Add submodule"
> > # me: "Oh crap! I did forget the configuration."
> > git submodule add --force <url> <gitlink>
> > # Git: "It already exists in the index, I am not going to produce the config for you."
> 
> The last step is changed with this patch, as
> it will just work fine then.

Thanks.

Cheers Heiko

  reply	other threads:[~2016-10-11 16:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 19:37 [PATCH 0/2] submodule pushes be extra careful Stefan Beller
2016-10-06 19:37 ` [PATCH 1/2] submodule add: extend force flag to add existing repos Stefan Beller
2016-10-06 20:11   ` Junio C Hamano
2016-10-07 12:52     ` Heiko Voigt
2016-10-07 17:25       ` Stefan Beller
2016-10-11 16:36         ` Heiko Voigt [this message]
2016-10-06 19:37 ` [PATCHv4 2/2] push: change submodule default to check when submodules exist Stefan Beller
2016-10-06 20:25   ` Junio C Hamano
2016-10-06 21:29     ` Stefan Beller
2016-10-06 23:41     ` [PATCHv5] " Stefan Beller

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=20161011163647.GA78554@book.hvoigt.net \
    --to=hvoigt@hvoigt.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=sbeller@google.com \
    --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 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.