git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jens Lehmann <Jens.Lehmann@web.de>
Cc: Jonathan Johnson <me@jondavidjohn.com>,
	Git Mailing List <git@vger.kernel.org>,
	Heiko Voigt <hvoigt@hvoigt.net>
Subject: Re: [PATCH v2 2/2] submodule add: Fail when .git/modules/<name> already exists unless forced
Date: Sun, 30 Sep 2012 17:06:58 -0700	[thread overview]
Message-ID: <7v7grbf42l.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <5068B329.7040302@web.de> (Jens Lehmann's message of "Sun, 30 Sep 2012 23:01:29 +0200")

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

>> Good point! I will add a more detailed error message (including
>> the url of the default remote which is configured for the already
>> present submodule repo) and teach --force to skip the test and
>> resurrect that submodule repo.
>
> The message when "git submodule add" finds .git/modules/<name> is:
>
> A git directory for '<name>' is found locally with remote(s):
>   origin	<url(s) from .git/modules/<name>>
> If you want to reuse this local git directory instead of cloning again from
>   <url given on command line>
> use the '--force' option. If the local git directory is not the correct repo
> or you are unsure what this means choose another name with the '--name' option.
>
> When run with the --force option the following message is printed:
>
> Reactivating local git directory for submodule '<name>'.

Thanks, will re-queue.

The approach "submodule rm" takes when removing a project is to
treat the removed submodule as not necessary for the current commit
in the superproject, but it is considered necessary elsewhere in the
history of the superproject, and that is why we stash away the
repository in $GIT_DIR/modules of the superproject.

We may however want to think about another mode of user error where
the user runs "submodule add $path" for a wrong repository, realizes
the mistake _before_ making any commit and try to repoint the $path
to a correct repository.  The behaviour of "submodule add" in this
patch, and the behaviour of existing "submodule rm", assumes that
the user is not stupid and won't make such a mistake, but to recover,
the user may need a way to really nuke the submodule repository that
was added by the earlier misteake (which is not needed anywhere in
the history of the superproject) and $GIT_DIR/module/$name really
replaced with the updated one.

I don't know how important to support a recovery procedure from such
mistakes, though.

      reply	other threads:[~2012-10-01  0:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-26  4:18 Bug in Submodule add Jonathan Johnson
2012-09-26 20:56 ` Jens Lehmann
2012-09-29 23:04   ` [PATCH 0/2] Let "git submodule add" fail when .git/modules/<name> already exists Jens Lehmann
2012-09-29 23:05     ` [PATCH 1/2] Teach "git submodule add" the --name option Jens Lehmann
2012-09-29 23:07     ` [PATCH 2/2] submodule add: Fail when .git/modules/<name> already exists Jens Lehmann
2012-09-30  4:47     ` [PATCH 0/2] Let "git submodule add" fail " Junio C Hamano
2012-09-30 19:19       ` Jens Lehmann
2012-09-30 21:01         ` [PATCH v2 2/2] submodule add: Fail when .git/modules/<name> already exists unless forced Jens Lehmann
2012-10-01  0:06           ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v7grbf42l.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=hvoigt@hvoigt.net \
    --cc=me@jondavidjohn.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).