diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go index e8480ec1b..783975f09 100644 --- a/pkg/commands/git_commands/commit_loader.go +++ b/pkg/commands/git_commands/commit_loader.go @@ -214,7 +214,7 @@ func (self *CommitLoader) extractCommitFromLine(hashPool *utils.StringPool, line } message := split[7] - tags := []string{} + var tags []string if extraInfo != "" { extraInfoFields := strings.Split(extraInfo, ",") diff --git a/pkg/commands/git_commands/commit_loader_test.go b/pkg/commands/git_commands/commit_loader_test.go index ba0cd9d84..2f7547b85 100644 --- a/pkg/commands/git_commands/commit_loader_test.go +++ b/pkg/commands/git_commands/commit_loader_test.go @@ -86,7 +86,7 @@ func TestGetCommits(t *testing.T) { Name: "better typing for rebase mode", Status: models.StatusUnpushed, Action: models.ActionNone, - Tags: []string{}, + Tags: nil, ExtraInfo: "(HEAD -> better-tests)", AuthorName: "Jesse Duffield", AuthorEmail: "jessedduffield@gmail.com", @@ -100,7 +100,7 @@ func TestGetCommits(t *testing.T) { Name: "fix logging", Status: models.StatusPushed, Action: models.ActionNone, - Tags: []string{}, + Tags: nil, ExtraInfo: "(origin/better-tests)", AuthorName: "Jesse Duffield", AuthorEmail: "jessedduffield@gmail.com", @@ -128,7 +128,7 @@ func TestGetCommits(t *testing.T) { Name: "WIP", Status: models.StatusPushed, Action: models.ActionNone, - Tags: []string{}, + Tags: nil, ExtraInfo: "", AuthorName: "Jesse Duffield", AuthorEmail: "jessedduffield@gmail.com", @@ -142,7 +142,7 @@ func TestGetCommits(t *testing.T) { Name: "WIP", Status: models.StatusPushed, Action: models.ActionNone, - Tags: []string{}, + Tags: nil, ExtraInfo: "", AuthorName: "Jesse Duffield", AuthorEmail: "jessedduffield@gmail.com", @@ -156,7 +156,7 @@ func TestGetCommits(t *testing.T) { Name: "WIP", Status: models.StatusMerged, Action: models.ActionNone, - Tags: []string{}, + Tags: nil, ExtraInfo: "", AuthorName: "Jesse Duffield", AuthorEmail: "jessedduffield@gmail.com", @@ -170,7 +170,7 @@ func TestGetCommits(t *testing.T) { Name: "WIP", Status: models.StatusMerged, Action: models.ActionNone, - Tags: []string{}, + Tags: nil, ExtraInfo: "", AuthorName: "Jesse Duffield", AuthorEmail: "jessedduffield@gmail.com", @@ -184,7 +184,7 @@ func TestGetCommits(t *testing.T) { Name: "refactoring the config struct", Status: models.StatusMerged, Action: models.ActionNone, - Tags: []string{}, + Tags: nil, ExtraInfo: "", AuthorName: "Jesse Duffield", AuthorEmail: "jessedduffield@gmail.com", @@ -220,7 +220,7 @@ func TestGetCommits(t *testing.T) { Name: "better typing for rebase mode", Status: models.StatusUnpushed, Action: models.ActionNone, - Tags: []string{}, + Tags: nil, ExtraInfo: "(HEAD -> better-tests)", AuthorName: "Jesse Duffield", AuthorEmail: "jessedduffield@gmail.com", @@ -258,7 +258,7 @@ func TestGetCommits(t *testing.T) { Name: "better typing for rebase mode", Status: models.StatusUnpushed, Action: models.ActionNone, - Tags: []string{}, + Tags: nil, ExtraInfo: "(HEAD -> better-tests)", AuthorName: "Jesse Duffield", AuthorEmail: "jessedduffield@gmail.com",