aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonio Jesus Navarro Perez <antonio@sourced.tech>2017-03-02 10:48:26 +0100
committerAntonio Jesus Navarro Perez <antonio@sourced.tech>2017-03-03 16:16:35 +0100
commitbe7e1e6443633728559577363e83fabd56e65a36 (patch)
tree4f24c9789ecc679d1ba723c989fba4724f3fbc59
parent900691567e51bf95bb92d36951e2b7b79d2596cc (diff)
downloadgo-git-be7e1e6443633728559577363e83fabd56e65a36.tar.gz
Add full stops and keep implementation details as internal comments.
-rw-r--r--blame.go15
-rw-r--r--references.go3
-rw-r--r--remote.go4
3 files changed, 14 insertions, 8 deletions
diff --git a/blame.go b/blame.go
index bf04570..a503b62 100644
--- a/blame.go
+++ b/blame.go
@@ -13,13 +13,13 @@ import (
"srcd.works/go-git.v4/utils/diff"
)
-// BlameResult represents the result of a Blame operation
+// BlameResult represents the result of a Blame operation.
type BlameResult struct {
- // Path is the path of the File that we're blaming
+ // Path is the path of the File that we're blaming.
Path string
- // Rev is the hash of the specified Commit used to generate this result
+ // Rev (Revision) is the hash of the specified Commit used to generate this result.
Rev plumbing.Hash
- // Lines contains every line with its authorship
+ // Lines contains every line with its authorship.
Lines []*Line
}
@@ -82,6 +82,11 @@ func Blame(c *object.Commit, path string) (*BlameResult, error) {
return nil, err
}
+ // Each node (line) holds the commit where it was introduced or
+ // last modified. To achieve that we use the FORWARD algorithm
+ // described in Zimmermann, et al. "Mining Version Archives for
+ // Co-changed Lines", in proceedings of the Mining Software
+ // Repositories workshop, Shanghai, May 22-23, 2006.
lines, err := newLines(finalLines, b.sliceGraph(len(b.graph)-1))
if err != nil {
return nil, err
@@ -96,7 +101,7 @@ func Blame(c *object.Commit, path string) (*BlameResult, error) {
// Line values represent the contents and author of a line in BlamedResult values.
type Line struct {
- // Author is the email address of the last author that modified the line
+ // Author is the email address of the last author that modified the line.
Author string
// Text is the original text of the line.
Text string
diff --git a/references.go b/references.go
index 338e2b7..68a54a6 100644
--- a/references.go
+++ b/references.go
@@ -21,7 +21,8 @@ import (
// - Moves and copies are not currently supported.
//
// - Cherry-picks are not detected unless there are no commits between them and
-// therefore can appear repeated in the list. (see git path-id for hints on how to fix this).
+// therefore can appear repeated in the list. (see git path-id for hints on how
+// to fix this).
func References(c *object.Commit, path string) ([]*object.Commit, error) {
var result []*object.Commit
seen := make(map[plumbing.Hash]struct{}, 0)
diff --git a/remote.go b/remote.go
index 4f034bb..580e6b0 100644
--- a/remote.go
+++ b/remote.go
@@ -22,7 +22,7 @@ import (
var NoErrAlreadyUpToDate = errors.New("already up-to-date")
-// Remote represents a connection to a remote repository
+// Remote represents a connection to a remote repository.
type Remote struct {
c *config.RemoteConfig
s storage.Storer
@@ -32,7 +32,7 @@ func newRemote(s storage.Storer, c *config.RemoteConfig) *Remote {
return &Remote{s: s, c: c}
}
-// Config returns the RemoteConfig object used to instantiate this Remote
+// Config returns the RemoteConfig object used to instantiate this Remote.
func (r *Remote) Config() *config.RemoteConfig {
return r.c
}