line-log: avoid unnecessary tree diffs when processing merge commits · git/git@a3540ed (original) (raw)
`@@ -1087,13 +1087,6 @@ static struct diff_filepair *diff_filepair_dup(struct diff_filepair *pair)
`
1087
1087
`return new_filepair;
`
1088
1088
`}
`
1089
1089
``
1090
``
`-
static void free_diffqueues(int n, struct diff_queue_struct *dq)
`
1091
``
`-
{
`
1092
``
`-
for (int i = 0; i < n; i++)
`
1093
``
`-
diff_queue_clear(&dq[i]);
`
1094
``
`-
free(dq);
`
1095
``
`-
}
`
1096
``
-
1097
1090
`static int process_all_files(struct line_log_data **range_out,
`
1098
1091
`struct rev_info *rev,
`
1099
1092
`struct diff_queue_struct *queue,
`
`@@ -1209,7 +1202,6 @@ static int process_ranges_ordinary_commit(struct rev_info *rev, struct commit *c
`
1209
1202
`static int process_ranges_merge_commit(struct rev_info *rev, struct commit *commit,
`
1210
1203
`struct line_log_data *range)
`
1211
1204
`{
`
1212
``
`-
struct diff_queue_struct *diffqueues;
`
1213
1205
`struct line_log_data **cand;
`
1214
1206
`struct commit **parents;
`
1215
1207
`struct commit_list *p;
`
`@@ -1220,20 +1212,19 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
`
1220
1212
`if (nparents > 1 && rev->first_parent_only)
`
1221
1213
`nparents = 1;
`
1222
1214
``
1223
``
`-
ALLOC_ARRAY(diffqueues, nparents);
`
1224
1215
`CALLOC_ARRAY(cand, nparents);
`
1225
1216
`ALLOC_ARRAY(parents, nparents);
`
1226
1217
``
1227
1218
`p = commit->parents;
`
1228
1219
`for (i = 0; i < nparents; i++) {
`
``
1220
`+
struct diff_queue_struct diffqueue = DIFF_QUEUE_INIT;
`
``
1221
`+
int changed;
`
1229
1222
`parents[i] = p->item;
`
1230
1223
`p = p->next;
`
1231
``
`-
queue_diffs(range, &rev->diffopt, &diffqueues[i], commit, parents[i]);
`
1232
``
`-
}
`
``
1224
`+
queue_diffs(range, &rev->diffopt, &diffqueue, commit, parents[i]);
`
1233
1225
``
1234
``
`-
for (i = 0; i < nparents; i++) {
`
1235
``
`-
int changed;
`
1236
``
`-
changed = process_all_files(&cand[i], rev, &diffqueues[i], range);
`
``
1226
`+
changed = process_all_files(&cand[i], rev, &diffqueue, range);
`
``
1227
`+
diff_queue_clear(&diffqueue);
`
1237
1228
`if (!changed) {
`
1238
1229
`/*
`
1239
1230
` * This parent can take all the blame, so we
`
`@@ -1267,7 +1258,6 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
`
1267
1258
`free(cand[i]);
`
1268
1259
` }
`
1269
1260
`free(cand);
`
1270
``
`-
free_diffqueues(nparents, diffqueues);
`
1271
1261
`return ret;
`
1272
1262
``
1273
1263
`/* NEEDSWORK evil merge detection stuff */
`