merge-file: handle empty files gracefully
[gitweb.git] / unpack-trees.c
index e9eb795d64b9cd6a6940995d41dd9c3f3239df02..aa2513ed798969c02fc5e14097666eb4c4c02bae 100644 (file)
@@ -590,7 +590,7 @@ static int merged_entry(struct cache_entry *merge, struct cache_entry *old,
                 * a match.
                 */
                if (same(old, merge)) {
-                       *merge = *old;
+                       memcpy(merge, old, offsetof(struct cache_entry, name));
                } else {
                        verify_uptodate(old, o);
                        invalidate_ce_path(old);