git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Kalyan Sriram" <kalyan@coderkalyan.com>
Cc: "Randall S. Becker" <rsbecker@nexbridge.com>,
	"'brian m. carlson'" <sandals@crustytoothpaste.net>,
	<git@vger.kernel.org>
Subject: Re: Git submodule remove
Date: Fri, 22 Oct 2021 14:17:18 -0700	[thread overview]
Message-ID: <xmqqlf2kep41.fsf@gitster.g> (raw)
In-Reply-To: <0101017ca921a6a0-96383fe2-4d73-47cb-83f7-4152b2c6ed7e-000000@us-west-2.amazonses.com> (Kalyan Sriram's message of "Fri, 22 Oct 2021 17:52:07 +0000")

"Kalyan Sriram" <kalyan@coderkalyan.com> writes:

>> The really unhappy place is when a user deletes the upstream submodule
>> repo itself after not seeing it in main any longer during
>> some cleanup adventure, then someone else tries to check out an older
>> commit that references the submodule.
>
> IMO this seems like a pretty unlikely situation to be in, which doesn't
> warrant *not* adding this feature. I get the idea, but how commonly do
> people checkout old commits and play around with them?

You MUST be able to go back to old versions.  Otherwise, why are we
working on a version control system?  You may find that in the old
days in v1.0 something used to work and in today's code it does not.
You would want to bisect and need to be able to go back to v1.0 that
still had the submodule you recently removed.  And you check where
in the history since v1.0 the actual breakage happend---it is called
"bisection" and people do that all the time.  IOW, it is VERY common.

And that is why I said "submodule rm" should *not* just "rm -fr
submodule-dir/", but ensure that submodule-dir/.git is absorbed (in
.git/modules/submodule-dir, most likely) before doing so, and then
the entry for the submodule should be removed from .gitmodules, but
I deliberatly did not mention anything about .git/config.  The entry
should in general _stay_ there, because having an entry for a
submodule in .git/config means you are interested in it (e.g. your
build may require having it, for a commit in the superproject that
still had the submodule there).  When you are on a commit in the
superproject after the submodule was removed, you may not have
anything from the submodule materialized in the working tree, but
when you go back in the history, you do still need to be able to
materialize it.

> In any case, this
> seems to be the project maintainer's problem, not git's.

You are correct.  The remote side removing some repository and
making it unavailable is just as bad as the site going down.  

On your side, you would want to be able to continue working even
when that happens, and not simply removing submodule-dir/.git
together with submodule-dir/ before making sure the submodule is
absorbed makes sure you'd have a local copy of the submodule
repository available just like you have local copy of the
superproject repository available.

      parent reply	other threads:[~2021-10-22 21:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 17:25 Git submodule remove Kalyan Sriram
2021-10-21 21:36 ` brian m. carlson
2021-10-21 22:47   ` Junio C Hamano
2021-10-21 23:25     ` Matheus Tavares
2021-10-21 23:35       ` Junio C Hamano
2021-10-22  3:32         ` Kalyan Sriram
2021-10-22 22:02           ` Junio C Hamano
2021-10-24 20:33             ` Kalyan Sriram
2021-10-24 20:46               ` Junio C Hamano
2021-10-22 12:12         ` Ævar Arnfjörð Bjarmason
2021-10-22 21:32           ` Junio C Hamano
2021-10-22 13:47     ` Randall S. Becker
2021-10-22 17:52       ` Kalyan Sriram
2021-10-22 20:45         ` Randall S. Becker
2021-10-22 21:17         ` 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=xmqqlf2kep41.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=kalyan@coderkalyan.com \
    --cc=rsbecker@nexbridge.com \
    --cc=sandals@crustytoothpaste.net \
    /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).