diff --git a/update-index.c b/update-index.c
index 767fd49721b26eb6c48d8dc77e5f83d2364eae28..bb730509b871381ffbd8457bd38ce940d78ba50d 100644 (file)
--- a/update-index.c
+++ b/update-index.c
memcpy(updated, ce, size);
fill_stat_cache_info(updated, &st);
+ /* In this case, if really is not set, we should leave
+ * CE_VALID bit alone. Otherwise, paths marked with
+ * --no-assume-unchanged (i.e. things to be edited) will
+ * reacquire CE_VALID bit automatically, which is not
+ * really what we want.
+ */
+ if (!really && assume_unchanged && !(ce->ce_flags & htons(CE_VALID)))
+ updated->ce_flags &= ~htons(CE_VALID);
+
return updated;
}