git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Sven Verdoolaege <skimo@kotnet.org>
To: Eran Tromer <git2eran@tromer.org>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] unpack-trees.c: assume submodules are clean during check-out
Date: Tue, 07 Aug 2007 10:51:49 +0200	[thread overview]
Message-ID: <20070807085149.GH999MdfPADPa@greensroom.kotnet.org> (raw)
In-Reply-To: <46B7E5FE.7050006@tromer.org>

On Mon, Aug 06, 2007 at 11:24:46PM -0400, Eran Tromer wrote:
> On 2007-08-06 15:03, Sven Verdoolaege wrote:
> >>>> Another approach is for pull, checkout etc. to automatically update the
> >>>> submodule' head ref, but no more.
> >>> Then everything, including "git submodule update", would assume
> >>> that the submodule is up-to-date.
> >> With that approach, "git submodule update" would fetch the submodule's
> >> head commit (which could be missing), and then check it against the
> >> submodule's index (and maybe its work tree).
> > And how is anyone supposed to figure out what HEAD the submodule's
> > index and working tree correspond to?
> 
> What HEAD corresponds to any other dirty index or dirty working tree?
> It's irrelevant and may not exist. You just have some random dirty state.

The only way to know that it's dirty is if you know the HEAD.
How can that not be relevant.

> > I can only hope that "git submodule update" would never blindly assume
> > that the submodule is clean and so the user would have to manually
> > sync the HEAD and the working tree.
> 
> Why would it assume that? In this approach, and ignoring submodule
> merging for now, "git submodule update" should mean roughly "cd
> submodule && git fetch HEAD && git reset --hard HEAD".

If you're doing that, then that is exactly what you are assuming.

> After all, this
> is really the only way to end up with the prescribed commit sha1.

That's the best way of losing all you precious changes in the submodule.
And there is no way to get them back!
Surely this is a lot worse than occasionally committing something you
didn't plan to commit, and only if you are performing a known "dangerous"
operation.

> I agree that for safety it makes sense to warn or abort if the index
> doesn't match ORIG_HEAD (saved by the supermodule checkout) or if the
> index doesn't match the work tree.

You may have done several supermodule checkouts since you last changed
the submodule.

skimo

  reply	other threads:[~2007-08-07  8:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-17 18:28 [PATCH] unpack-trees.c: assume submodules are clean during check-out Sven Verdoolaege
2007-07-18  7:29 ` Junio C Hamano
2007-08-01 14:05   ` Sven Verdoolaege
2007-08-04  5:13     ` Junio C Hamano
2007-08-04 11:41       ` Lars Hjemli
2007-08-05  6:02         ` Junio C Hamano
2007-08-05 13:55         ` Sven Verdoolaege
2007-08-04 16:03       ` Eran Tromer
2007-08-05  6:12         ` Junio C Hamano
2007-08-05 14:46         ` Sven Verdoolaege
2007-08-06 18:42           ` Eran Tromer
2007-08-06 19:03             ` Sven Verdoolaege
2007-08-07  3:24               ` Eran Tromer
2007-08-07  8:51                 ` Sven Verdoolaege [this message]
2007-08-08  1:41                   ` Eran Tromer
2007-08-08 11:39                     ` Sven Verdoolaege

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=20070807085149.GH999MdfPADPa@greensroom.kotnet.org \
    --to=skimo@kotnet.org \
    --cc=git2eran@tromer.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=skimo@liacs.nl \
    /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).