Thread (1 message) 1 message, 1 author, 2016-06-15

Re: Simplify "git reset --hard"

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:26
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Junio C Hamano [off-list ref] writes:
quoted
Instead, just pass in "-u" to git-read-tree when we do a hard reset, and 
depend on git-read-tree to update the working tree appropriately.
Well, this is wrong.  Local modifications remain after your
version of "git-reset --hard HEAD". which is not what we want
from a hard reset.
... and attempting to paper it over in git-reset.sh is also
wrong.  Keep your "--hard is noop" change in git-reset.sh and
replace it with this would be the right fix.

-- >8 --
diff --git a/read-tree.c b/read-tree.c
index 11157f4..c135f08 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -686,6 +686,7 @@ static int oneway_merge(struct cache_ent
 	if (!a)
 		return deleted_entry(old, NULL);
 	if (old && same(old, a)) {
+		old->ce_flags |= htons(CE_UPDATE);
 		return keep_entry(old);
 	}
 	return merged_entry(a, NULL);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help