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

Function log_tree_diff

log-tree.c:1097–1174  ·  view source on GitHub ↗

* Show the diff of a commit. * * Return true if we printed any log info messages */

Source from the content-addressed store, hash-verified

1095 * Return true if we printed any log info messages
1096 */
1097static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log_info *log)
1098{
1099 int showed_log;
1100 struct commit_list *parents;
1101 struct object_id *oid;
1102 int is_merge;
1103 int all_need_diff = opt->diff || opt->diffopt.flags.exit_with_status;
1104
1105 if (!all_need_diff && !opt->merges_need_diff)
1106 return 0;
1107
1108 if (opt->line_level_traverse) {
1109 line_log_queue_pairs(opt, commit);
1110 log_tree_diff_flush(opt);
1111 return !opt->loginfo;
1112 }
1113
1114 parse_commit_or_die(commit);
1115 oid = get_commit_tree_oid(commit);
1116
1117 parents = get_saved_parents(opt, commit);
1118 is_merge = parents && parents->next;
1119 if (!is_merge && !all_need_diff)
1120 return 0;
1121
1122 /* Root commit? */
1123 if (!parents) {
1124 if (opt->show_root_diff) {
1125 diff_root_tree_oid(oid, "", &opt->diffopt);
1126 log_tree_diff_flush(opt);
1127 }
1128 return !opt->loginfo;
1129 }
1130
1131 if (is_merge) {
1132 int octopus = (parents->next->next != NULL);
1133
1134 if (opt->remerge_diff) {
1135 if (octopus) {
1136 show_log(opt);
1137 fprintf(opt->diffopt.file,
1138 "diff: warning: Skipping remerge-diff "
1139 "for octopus merges.\n");
1140 return 1;
1141 }
1142 return do_remerge_diff(opt, parents, oid);
1143 }
1144 if (opt->combine_merges)
1145 return do_diff_combined(opt, commit);
1146 if (opt->separate_merges) {
1147 if (!opt->first_parent_merges) {
1148 /* Show parent info for multiple diffs */
1149 log->parent = parents->item;
1150 }
1151 } else
1152 return 0;
1153 }
1154

Callers 1

log_tree_commitFunction · 0.85

Calls 10

line_log_queue_pairsFunction · 0.85
log_tree_diff_flushFunction · 0.85
parse_commit_or_dieFunction · 0.85
get_commit_tree_oidFunction · 0.85
get_saved_parentsFunction · 0.85
diff_root_tree_oidFunction · 0.85
show_logFunction · 0.85
do_remerge_diffFunction · 0.85
do_diff_combinedFunction · 0.85
diff_tree_oidFunction · 0.85

Tested by

no test coverage detected