@@ -13,17 +13,21 @@ import (
13
13
"srcd.works/go-git.v4/utils/diff"
14
14
)
15
15
16
+ // BlameResult represents the result of a Blame operation
16
17
type BlameResult struct {
17
- Path string
18
- Rev plumbing.Hash
18
+ // Path is the path of the File that we're blaming
19
+ Path string
20
+ // Rev is the hash of the specified Commit used to generate this result
21
+ Rev plumbing.Hash
22
+ // Lines contains every line with its authorship
19
23
Lines []* Line
20
24
}
21
25
22
- // Blame returns the last commit that modified each line of a file in a
23
- // repository.
24
- //
25
- // The file to blame is identified by the input arguments: repo, commit and path.
26
- // The output is a slice of commits, one for each line in the file .
26
+ // Blame returns a BlameResult that contains all the data needed to know the
27
+ // last author of each line of an specified file starting the history from
28
+ // a specified commit. The file to blame is identified by the input arguments:
29
+ // commit and path. commit is a Commit object obtained from a Repository. Path
30
+ // represents a path to a specific file contained into the repository .
27
31
//
28
32
// Blaming a file is a two step process:
29
33
//
@@ -33,12 +37,6 @@ type BlameResult struct {
33
37
// 2. Then build a graph with a node for every line in every file in
34
38
// the history of the file.
35
39
//
36
- // Each node (line) holds the commit where it was introduced or
37
- // last modified. To achieve that we use the FORWARD algorithm
38
- // described in Zimmermann, et al. "Mining Version Archives for
39
- // Co-changed Lines", in proceedings of the Mining Software
40
- // Repositories workshop, Shanghai, May 22-23, 2006.
41
- //
42
40
// Each node is assigned a commit: Start by the nodes in the first
43
41
// commit. Assign that commit as the creator of all its lines.
44
42
//
@@ -98,8 +96,10 @@ func Blame(c *object.Commit, path string) (*BlameResult, error) {
98
96
99
97
// Line values represent the contents and author of a line in BlamedResult values.
100
98
type Line struct {
101
- Author string // email address of the author of the line.
102
- Text string // original text of the line.
99
+ // Author is the email address of the last author that modified the line
100
+ Author string
101
+ // Text is the original text of the line.
102
+ Text string
103
103
}
104
104
105
105
func newLine (author , text string ) * Line {
0 commit comments