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

Function diff_flush_patch

diff.c:6537–6563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6535}
6536
6537static void diff_flush_patch(struct diff_filepair *p, struct diff_options *o)
6538{
6539 int include_conflict_headers =
6540 (additional_headers(o, p->one->path) &&
6541 !o->pickaxe_opts &&
6542 (!o->filter || filter_bit_tst(DIFF_STATUS_UNMERGED, o)));
6543
6544 /*
6545 * Check if we can return early without showing a diff. Note that
6546 * diff_filepair only stores {oid, path, mode, is_valid}
6547 * information for each path, and thus diff_unmodified_pair() only
6548 * considers those bits of info. However, we do not want pairs
6549 * created by create_filepairs_for_header_only_notifications()
6550 * (which always look like unmodified pairs) to be ignored, so
6551 * return early if both p is unmodified AND we don't want to
6552 * include_conflict_headers.
6553 */
6554 if (diff_unmodified_pair(p) && !include_conflict_headers)
6555 return;
6556
6557 /* Actually, we can also return early to avoid showing tree diffs */
6558 if ((DIFF_FILE_VALID(p->one) && S_ISDIR(p->one->mode)) ||
6559 (DIFF_FILE_VALID(p->two) && S_ISDIR(p->two->mode)))
6560 return;
6561
6562 run_diff(p, o);
6563}
6564
6565/* return 1 if any change is found; otherwise, return 0 */
6566static int diff_flush_patch_quietly(struct diff_filepair *p, struct diff_options *o)

Callers 2

diff_flush_patch_quietlyFunction · 0.85

Calls 4

additional_headersFunction · 0.85
filter_bit_tstFunction · 0.85
diff_unmodified_pairFunction · 0.85
run_diffFunction · 0.70

Tested by

no test coverage detected