- oldmode = ntohl(old->ce_mode);
- if (mode == oldmode && !memcmp(sha1, old->sha1, 20))
+ *sha1p = sha1;
+ *modep = mode;
+ return 0;
+}
+
+static void show_new_file(struct cache_entry *new)
+{
+ unsigned char *sha1;
+ unsigned int mode;
+
+ /* New file in the index: it might actually be different in the working copy */
+ if (get_stat_data(new, &sha1, &mode) < 0)
+ return;
+
+ show_file("+", new, sha1, mode);
+}
+
+static int show_modified(struct cache_entry *old,
+ struct cache_entry *new,
+ int report_missing)
+{
+ unsigned int mode, oldmode;
+ unsigned char *sha1;
+
+ if (get_stat_data(new, &sha1, &mode) < 0) {
+ if (report_missing)
+ show_file("-", old, old->sha1, old->ce_mode);
+ return -1;
+ }
+
+ oldmode = old->ce_mode;
+ if (mode == oldmode && !memcmp(sha1, old->sha1, 20) &&
+ detect_rename < DIFF_DETECT_COPY)