aboutsummaryrefslogtreecommitdiffstats
path: root/blame.go
diff options
context:
space:
mode:
authorShane Da Silva <shanemichaeldasilva@gmail.com>2018-02-19 09:19:00 -0800
committerShane Da Silva <shanemichaeldasilva@gmail.com>2018-02-19 09:19:00 -0800
commit0c19e6b0cb696005d94e4385303ef8b48376b92f (patch)
tree13d95f57f19e615a0282245b12681f65b0ee6d0d /blame.go
parent3f00f5f02f0b2a1beb6d4ad5cac5e2a0f4c13853 (diff)
downloadgo-git-0c19e6b0cb696005d94e4385303ef8b48376b92f.tar.gz
blame.go: Add blame line data
Signed-off-by: Shane Da Silva <shanemichaeldasilva@gmail.com>
Diffstat (limited to 'blame.go')
-rw-r--r--blame.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/blame.go b/blame.go
index df112ca..3c5840f 100644
--- a/blame.go
+++ b/blame.go
@@ -6,6 +6,7 @@ import (
"fmt"
"strconv"
"strings"
+ "time"
"unicode/utf8"
"gopkg.in/src-d/go-git.v4/plumbing"
@@ -106,12 +107,15 @@ type Line struct {
Author string
// Text is the original text of the line.
Text string
+ // Date is when the original text of the line was introduced
+ Date time.Time
}
-func newLine(author, text string) *Line {
+func newLine(author, text string, date time.Time) *Line {
return &Line{
Author: author,
Text: text,
+ Date: date,
}
}
@@ -121,7 +125,7 @@ func newLines(contents []string, commits []*object.Commit) ([]*Line, error) {
}
result := make([]*Line, 0, len(contents))
for i := range contents {
- l := newLine(commits[i].Author.Email, contents[i])
+ l := newLine(commits[i].Author.Email, contents[i], commits[i].Author.When)
result = append(result, l)
}
return result, nil