Thread (10 messages) flat view 10 messages, 4 authors, 2016-06-15

Re: [PATCH] unpack-trees.c: assume submodules are clean during check-out

From: Sven Verdoolaege <hidden>
Date: 2016-06-15 22:43:27

Possibly related (same subject, not in this thread)

On Mon, Aug 06, 2007 at 11:24:46PM -0400, Eran Tromer wrote:
On 2007-08-06 15:03, Sven Verdoolaege wrote:
quoted
quoted
quoted
quoted
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.
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help