Skip to content

Commit 3602da0

Browse files
committed
don't pass the SHA in of the head, so that uncomitted todos get picked up as well
1 parent e9a1db2 commit 3602da0

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

cmd/commands/todos.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/augmentable-dev/tickgit/pkg/todos"
1212
"github.com/briandowns/spinner"
1313
"github.com/spf13/cobra"
14-
"gopkg.in/src-d/go-git.v4"
1514
)
1615

1716
func init() {
@@ -40,15 +39,6 @@ var todosCmd = &cobra.Command{
4039

4140
validateDir(dir)
4241

43-
r, err := git.PlainOpen(dir)
44-
handleError(err)
45-
46-
ref, err := r.Head()
47-
handleError(err)
48-
49-
commit, err := r.CommitObject(ref.Hash())
50-
handleError(err)
51-
5242
comments, err := comments.SearchDir(dir)
5343
handleError(err)
5444

@@ -58,7 +48,7 @@ var todosCmd = &cobra.Command{
5848
// timeout after 30 seconds
5949
// ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
6050
// defer cancel()
61-
err = t.FindBlame(ctx, dir, commit.Hash.String())
51+
err = t.FindBlame(ctx, dir)
6252
sort.Sort(&t)
6353

6454
handleError(err)

pkg/todos/todos.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (t *ToDo) existsInCommit(commit *object.Commit) (bool, error) {
116116
}
117117

118118
// FindBlame sets the blame information on each todo in a set of todos
119-
func (t *ToDos) FindBlame(ctx context.Context, dir, sha string) error {
119+
func (t *ToDos) FindBlame(ctx context.Context, dir string) error {
120120
fileMap := make(map[string]ToDos)
121121
for _, todo := range *t {
122122
filePath := todo.FilePath
@@ -135,7 +135,6 @@ func (t *ToDos) FindBlame(ctx context.Context, dir, sha string) error {
135135
blames, err := blame.Exec(ctx, filePath, &blame.Options{
136136
Directory: dir,
137137
Lines: lines,
138-
SHA: sha,
139138
})
140139
if err != nil {
141140
return err

0 commit comments

Comments
 (0)