MCPcopy Create free account
hub / github.com/git/git / range_set_shift_diff

Function range_set_shift_diff

line-log.c:430–448  ·  view source on GitHub ↗

* Adjust the line counts in 'rs' to account for the lines * added/removed in the diff. */

Source from the content-addressed store, hash-verified

428 * added/removed in the diff.
429 */
430static void range_set_shift_diff(struct range_set *out,
431 struct range_set *rs,
432 struct diff_ranges *diff)
433{
434 unsigned int i, j = 0;
435 long offset = 0;
436 struct range *src = rs->ranges;
437 struct range *target = diff->target.ranges;
438 struct range *parent = diff->parent.ranges;
439
440 for (i = 0; i < rs->nr; i++) {
441 while (j < diff->target.nr && src[i].start >= target[j].start) {
442 offset += (parent[j].end-parent[j].start)
443 - (target[j].end-target[j].start);
444 j++;
445 }
446 range_set_append(out, src[i].start+offset, src[i].end+offset);
447 }
448}
449
450/*
451 * Given a diff and the set of interesting ranges, map the ranges

Callers 1

Calls 1

range_set_appendFunction · 0.85

Tested by

no test coverage detected