combine-diff: calculate mode_differs earlier

One loop combined both the patch generation and checking whether there was any mode change to report. Let's factor that into two separate loops, as we may care about the mode change even if we are not generating patches (e.g., because we are showing a binary diff, which will come in a future patch). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed May 23, 2011 at 16:16 UTC c95b99bb5d5f3aed88f8154371a813ebd0d2fa1d
1 file changed +7 -2
combine-diff.c
+7 -2
@@ -845,6 +845,13 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
845 close(fd);
846 }
847
848 + for (i = 0; i < num_parent; i++) {
849 + if (elem->parent[i].mode != elem->mode) {
850 + mode_differs = 1;
851 + break;
852 + }
853 + }
854 +
855 for (cnt = 0, cp = result; cp < result + result_size; cp++) {
856 if (*cp == '\n')
857 cnt++;
@@ -893,8 +900,6 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
900 elem->parent[i].mode,
901 &result_file, sline,
902 cnt, i, num_parent, result_deleted);
896 - if (elem->parent[i].mode != elem->mode)
897 - mode_differs = 1;
903 }
904
905 show_hunks = make_hunks(sline, cnt, num_parent, dense);