1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-06 17:23:00 +01:00
Commit graph

6 commits

Author SHA1 Message Date
Junio C Hamano
4a0fc95f18 git-pickaxe: introduce heuristics to avoid "trivial" chunks
This adds scoring logic to blame_entry to prevent blames on very
trivial chunks (e.g. lots of empty lines, indent followed by a
closing brace) from being passed down to unrelated lines in the
parent.

The current heuristics are quite simple and may need to be
tweaked later, but we need to start somewhere.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-20 18:48:23 -07:00
Junio C Hamano
5ff62c3002 git-pickaxe: improve "best match" heuristics
Instead of comparing number of lines matched, look at the
matched characters and count alnums, so that we do not pass
blame on not-so-interesting lines, such as an empty line and
a line that is indentation followed by a closing brace.

Add an option --score-debug to show the score of each
blame_entry while we cook this further on the "next" branch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-20 18:48:23 -07:00
Junio C Hamano
1ca6ca876e git-pickaxe: fix nth_line()
We would want to be able to refer to the end of the file as
"the beginning of Nth line" for a file that is N lines long.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-20 18:48:18 -07:00
Junio C Hamano
18abd745a0 git-pickaxe -C: blame cut-and-pasted lines.
This completes the initial round of git-pickaxe.  In addition to
the detection of line movements we already have, this finds new
lines that were created by moving or cutting-and-pasting lines
from different files in the parent.

With this,

	git pickaxe -f -n -C v1.4.0 -- revision.c

finds that a major part of that file actually came from
rev-list.c when Linus split the latter at commit ae563642 and
blames them to earlier commits that touch rev-list.c.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-20 00:30:44 -07:00
Junio C Hamano
d24bba8008 git-pickaxe -M: blame line movements within a file.
This makes pickaxe more intelligent than the classic blame.

A typical example is a change that moves one static C function
from lower part of the file to upper part of the same file,
because you added a new caller in the middle.

The versions in the parent and the child would look like this:

        parent            child

        A                 static foo() {
        B                 ...
        C                 }
        D                 A
        E                 B
        F                 C
        G                 D
        static foo() {    ... call foo();
        ...               E
        }                 F
        H                 G
                          H

With the classic blame algorithm, we can blame lines A B C D E F
G and H to the parent.  The child is guilty of introducing the
line "... call foo();", and the blame is placed on the child.
However, the classic blame algorithm fails to notice that the
implementation of foo() at the top of the file is not new, and
moved from the lower part of the parent.

This commit introduces detection of such line movements, and
correctly blames the lines that were simply moved in the file to
the parent.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-20 00:27:05 -07:00
Junio C Hamano
cee7f245dc git-pickaxe: blame rewritten.
Currently it does what git-blame does, but only faster.

More importantly, its internal structure is designed to support
content movement (aka cut-and-paste) more easily by allowing
more than one paths to be taken from the same commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-19 22:42:49 -07:00