Commit a07a977
blame: use the fingerprint heuristic to match ignored lines
This commit integrates the fuzzy fingerprint heuristic into
guess_line_blames().
We actually make two passes. The first pass uses the fuzzy algorithm to
find a match within the current diff chunk. If that fails, the second
pass searches the entire parent file for the best match.
For an example of scanning the entire parent for a match, consider:
commit-a 30) #include <sys/header_a.h>
commit-b 31) #include <header_b.h>
commit-c 32) #include <header_c.h>
Then commit X alphabetizes them:
commit-X 30) #include <header_b.h>
commit-X 31) #include <header_c.h>
commit-X 32) #include <sys/header_a.h>
If we just check the parent's chunk (i.e. the first pass), we'd get:
commit-b 30) #include <header_b.h>
commit-c 31) #include <header_c.h>
commit-X 32) #include <sys/header_a.h>
That's because commit X actually consists of two chunks: one chunk is
removing sys/header_a.h, then some context, and the second chunk is
adding sys/header_a.h.
If we scan the entire parent file, we get:
commit-b 30) #include <header_b.h>
commit-c 31) #include <header_c.h>
commit-a 32) #include <sys/header_a.h>
Signed-off-by: Barret Rhoden <brho@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 1d028dc commit a07a977
2 files changed
+55
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
989 | 989 | | |
990 | 990 | | |
991 | 991 | | |
992 | | - | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
993 | 995 | | |
994 | 996 | | |
995 | 997 | | |
996 | 998 | | |
997 | 999 | | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
998 | 1005 | | |
999 | 1006 | | |
1000 | 1007 | | |
| |||
1572 | 1579 | | |
1573 | 1580 | | |
1574 | 1581 | | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
1575 | 1605 | | |
1576 | | - | |
1577 | | - | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
1578 | 1610 | | |
1579 | 1611 | | |
1580 | 1612 | | |
| |||
1583 | 1615 | | |
1584 | 1616 | | |
1585 | 1617 | | |
| 1618 | + | |
1586 | 1619 | | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
1587 | 1623 | | |
1588 | 1624 | | |
1589 | | - | |
1590 | | - | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
1591 | 1634 | | |
1592 | 1635 | | |
1593 | 1636 | | |
1594 | 1637 | | |
1595 | 1638 | | |
1596 | 1639 | | |
1597 | 1640 | | |
| 1641 | + | |
1598 | 1642 | | |
1599 | 1643 | | |
1600 | 1644 | | |
| |||
2371 | 2415 | | |
2372 | 2416 | | |
2373 | 2417 | | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
2374 | 2424 | | |
2375 | 2425 | | |
2376 | 2426 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | 6 | | |
10 | 7 | | |
11 | 8 | | |
| |||
0 commit comments