Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-05-24 00:16:59 +0400
committerJunio C Hamano <gitster@pobox.com>2011-05-24 02:40:51 +0400
commitc95b99bb5d5f3aed88f8154371a813ebd0d2fa1d (patch)
treebd5dd1b32ac7d6b9958aa0893ce5da6cf70bdcb8 /combine-diff.c
parent7c978a068f0575a90570e4579c71a5f641bdfad3 (diff)
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>
Diffstat (limited to 'combine-diff.c')
-rw-r--r--combine-diff.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/combine-diff.c b/combine-diff.c
index 309dc6c272..2183184eed 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -845,6 +845,13 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
close(fd);
}
+ for (i = 0; i < num_parent; i++) {
+ if (elem->parent[i].mode != elem->mode) {
+ mode_differs = 1;
+ break;
+ }
+ }
+
for (cnt = 0, cp = result; cp < result + result_size; cp++) {
if (*cp == '\n')
cnt++;
@@ -893,8 +900,6 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
elem->parent[i].mode,
&result_file, sline,
cnt, i, num_parent, result_deleted);
- if (elem->parent[i].mode != elem->mode)
- mode_differs = 1;
}
show_hunks = make_hunks(sline, cnt, num_parent, dense);