git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Heiko Voigt <hvoigt@hvoigt.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Adam Spiers <git@adamspiers.org>,
	Git Mailing List <git@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] update-index: allow overwriting existing submodule index entries
Date: Tue, 12 Jun 2012 23:18:05 +0200	[thread overview]
Message-ID: <4FD7B20D.9080803@web.de> (raw)
In-Reply-To: <20120612203316.GA17053@book.hvoigt.net>

Am 12.06.2012 22:33, schrieb Heiko Voigt:
> Here a quick idea of what we could do:
> 
> We could mark a path as transitioned from submodule (similar to the
> assume unchanged bit) if files were skipped due to removal of a
> submodule and have submodule update clear that flag. That way we could
> teach diff, status and so on to only show one entry for a submodule to
> be removed and replaced with something else.
> 
> Thinking further: We could actually prevent adding such an out-of-date
> submodule as a safeguard. Which in fact was something which happened by
> mistake to some of our users. The story is that when you see a *changed*
> submodule in a merge conflict it can be easily mistaken for needing
> resolution and added to the merge. Most times this rewinds your
> submodule to some old state
> 
> If we agree on how to handle the submodule => file(s) cases I think the
> implementation in the submodule script possibly requires less work than
> the fully fledged recursive checkout and could also be used for gaining
> some experience with such transitions.
> 
> So the first step would be to extend submodule update to support the
> removal of submodules. The next step is then that we finish the fully
> automatic recursive submodule checkout.
> 
> What do you think of such a two step plan?

Hmm, I suspect the real problem here is that "git submodule update" is
run *after* the actual checkout, merge, reset or whatever. So if for
example you want to replace a submodule with a plain directory containing
the same files the submodule update would not only have to remove the now
obsolete submodule but also has to remember to check out all files in the
former submodule directory again. IMO this should be part of the initial
unpack_trees(), not done in a later script. Imagine a submodule having
local modifications which would be overwritten by the checkout, then the
later submodule update would have to fail (when used without -f) to
protect the users changes. The only sane thing to do would be to not allow
such a checkout in the first place (when the user chose to automatically
update submodules that is) but abort just like we do for changes to
regular files right now telling the user to save his changes.

And I suspect you would have to teach at least status and diff to give
meaningful output in that "submodule should be removed and replaced with
something else but submodule update hasn't run yet" case, and apart from
the change to add you mentioned above some other commands might need
safeguards too.

So me thinks we should skip step one and implement recursive checkout
right away. Adding much more complexity to the submodule script for an
intermediate solution doesn't sound like a good idea to me.

      reply	other threads:[~2012-06-12 21:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-01 10:31 Bug in git citool when staging symlink as replacement for submodule Adam Spiers
2012-06-09 13:47 ` [PATCH] git-gui: recognize submodule diff when replaced by file Heiko Voigt
2012-06-09 14:27 ` [PATCH] update-index: allow overwriting existing submodule index entries Heiko Voigt
2012-06-11 15:03   ` Junio C Hamano
2012-06-11 21:23     ` Jens Lehmann
2012-06-12 20:33       ` Heiko Voigt
2012-06-12 21:18         ` Jens Lehmann [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=4FD7B20D.9080803@web.de \
    --to=jens.lehmann@web.de \
    --cc=git@adamspiers.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hvoigt@hvoigt.net \
    --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.
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).