MCPcopy Index your code
hub / github.com/git/git / process_ranges_merge_commit

Function process_ranges_merge_commit

line-log.c:1073–1135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1071}
1072
1073static int process_ranges_merge_commit(struct rev_info *rev, struct commit *commit,
1074 struct line_log_data *range)
1075{
1076 struct line_log_data **cand;
1077 struct commit_list *p;
1078 int i;
1079 int nparents = commit_list_count(commit->parents);
1080 int ret;
1081
1082 if (nparents > 1 && rev->first_parent_only)
1083 nparents = 1;
1084
1085 CALLOC_ARRAY(cand, nparents);
1086
1087 for (p = commit->parents, i = 0;
1088 p && i < nparents;
1089 p = p->next, i++) {
1090 struct commit *parent = p->item;
1091 struct diff_queue_struct diffqueue = DIFF_QUEUE_INIT;
1092 int changed;
1093
1094 queue_diffs(range, &rev->diffopt, &diffqueue, commit, parent);
1095
1096 changed = process_all_files(&cand[i], rev, &diffqueue, range);
1097 diff_queue_clear(&diffqueue);
1098 if (!changed) {
1099 /*
1100 * This parent can take all the blame, so we
1101 * don't follow any other path in history
1102 */
1103 add_line_range(rev, parent, cand[i]);
1104 commit_list_free(commit->parents);
1105 commit_list_append(parent, &commit->parents);
1106
1107 ret = 0;
1108 goto out;
1109 }
1110 }
1111
1112 /*
1113 * No single parent took the blame. We add the candidates
1114 * from the above loop to the parents.
1115 */
1116 for (p = commit->parents, i = 0;
1117 p && i < nparents;
1118 p = p->next, i++)
1119 add_line_range(rev, p->item, cand[i]);
1120
1121 ret = 1;
1122
1123out:
1124 clear_commit_line_range(rev, commit);
1125 for (i = 0; i < nparents; i++) {
1126 if (!cand[i])
1127 continue;
1128 line_log_data_clear(cand[i]);
1129 free(cand[i]);
1130 }

Calls 9

commit_list_countFunction · 0.85
queue_diffsFunction · 0.85
process_all_filesFunction · 0.85
diff_queue_clearFunction · 0.85
add_line_rangeFunction · 0.85
commit_list_freeFunction · 0.85
commit_list_appendFunction · 0.85
clear_commit_line_rangeFunction · 0.85
line_log_data_clearFunction · 0.85

Tested by

no test coverage detected