From: Eran Tromer <git2eran@tromer.org>
To: skimo@liacs.nl
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 21:41:34 -0400 [thread overview]
Message-ID: <46B91F4E.8050008@tromer.org> (raw)
In-Reply-To: <20070807085149.GH999MdfPADPa@greensroom.kotnet.org>
On 2007-08-07 04:51, Sven Verdoolaege wrote:
> 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.
>
Are you saying that
$ git reset --hard HEAD && vi foo && git commit -a
is a "known dangerous" operation that can record corrupted content even
though you didn't touch it? This is very bad news indeed! I don't see
any such warnings in the documentation.
So, when I'm sure all the edits I did in the work tree are fine, how
*do* I safely make a commit without manually inspecting the changed
files list, or manually listing the changed files for "git add", or
manually running "git submodule update", or manually checking whether
there happens to be some submodules in this project, some other such
cumbersome measure?
> You may have done several supermodule checkouts since you last changed
> the submodule.
True, that approach won't work. I can imagine some logic to
conditionally update ORIG_HEAD, but it gets messy and fragile. Looks
like brokenness is just inevitable when you let the state get stale and
then merrily read it out as if it's fresh.
So.... Maybe we can tackle this head-on? Let index entries be explicitly
marked as "adrift", meaning we just don't touch the work tree for these
entries -- neither reads nor writes. It's used when the piece of
content, say a submodule, is allowed to drift arbitrarily in the work
tree in a way that doesn't represent meaningful edits that should be
reflected in commits, diffs, etc.
For example:
- "git checkout" sets the "adrift" flag on all (modified?) submodules
- "git submodule update" undrifts ("moores?") the submodules
- "git commit -a" skips files that are adrift, and likewise "git add .",
"git diff" etc. (perhaps with some warning?)
- "git add <path>" undrifts <path> and proceeds as usual
- "git status" reports drifting files as such and doesn't bother to
check them in the work tree
- When merging into the work tree, drifting files are left as such
And why stop at submodules? If there's a large blob you don't want to
check out, just "git drift <path>" it. To set whole *directories*
adrift, we can piggybacking on the empty-directory support (i.e., add a
directory entry to the index and set it adrift). So this could be the
basis of partial-checkout support.
Does this sound reasonable?
Eran
next prev parent reply other threads:[~2007-08-08 1:42 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
2007-08-08 1:41 ` Eran Tromer [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46B91F4E.8050008@tromer.org \
--to=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.
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 NNTP newsgroup(s).