From 188773511e0c94a4ec338328865e824402ec8b00 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 3 Apr 2023 12:40:29 +0200 Subject: Store commit.Status as an enum instead of a string This is unrelated to the changes in this PR, but since we are doing the same thing for the commit.Action field in the next commit, it makes sense to do it for Status too for consistency. Modelling this as an enum feels more natural than modelling it as a string, since there's a finite set of possible values. And it saves a little bit of memory (not very much, since none of the strings were heap-allocated, but still). --- pkg/commands/git_commands/reflog_commit_loader_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'pkg/commands/git_commands/reflog_commit_loader_test.go') diff --git a/pkg/commands/git_commands/reflog_commit_loader_test.go b/pkg/commands/git_commands/reflog_commit_loader_test.go index 7170196e9..a51a40e69 100644 --- a/pkg/commands/git_commands/reflog_commit_loader_test.go +++ b/pkg/commands/git_commands/reflog_commit_loader_test.go @@ -51,35 +51,35 @@ func TestGetReflogCommits(t *testing.T) { { Sha: "c3c4b66b64c97ffeecde", Name: "checkout: moving from A to B", - Status: "reflog", + Status: models.StatusReflog, UnixTimestamp: 1643150483, Parents: []string{"51baa8c1"}, }, { Sha: "c3c4b66b64c97ffeecde", Name: "checkout: moving from B to A", - Status: "reflog", + Status: models.StatusReflog, UnixTimestamp: 1643150483, Parents: []string{"51baa8c1"}, }, { Sha: "c3c4b66b64c97ffeecde", Name: "checkout: moving from A to B", - Status: "reflog", + Status: models.StatusReflog, UnixTimestamp: 1643150483, Parents: []string{"51baa8c1"}, }, { Sha: "c3c4b66b64c97ffeecde", Name: "checkout: moving from master to A", - Status: "reflog", + Status: models.StatusReflog, UnixTimestamp: 1643150483, Parents: []string{"51baa8c1"}, }, { Sha: "f4ddf2f0d4be4ccc7efa", Name: "checkout: moving from A to master", - Status: "reflog", + Status: models.StatusReflog, UnixTimestamp: 1643149435, Parents: []string{"51baa8c1"}, }, @@ -95,7 +95,7 @@ func TestGetReflogCommits(t *testing.T) { lastReflogCommit: &models.Commit{ Sha: "c3c4b66b64c97ffeecde", Name: "checkout: moving from B to A", - Status: "reflog", + Status: models.StatusReflog, UnixTimestamp: 1643150483, Parents: []string{"51baa8c1"}, }, @@ -103,7 +103,7 @@ func TestGetReflogCommits(t *testing.T) { { Sha: "c3c4b66b64c97ffeecde", Name: "checkout: moving from A to B", - Status: "reflog", + Status: models.StatusReflog, UnixTimestamp: 1643150483, Parents: []string{"51baa8c1"}, }, @@ -119,7 +119,7 @@ func TestGetReflogCommits(t *testing.T) { lastReflogCommit: &models.Commit{ Sha: "c3c4b66b64c97ffeecde", Name: "checkout: moving from B to A", - Status: "reflog", + Status: models.StatusReflog, UnixTimestamp: 1643150483, Parents: []string{"51baa8c1"}, }, @@ -128,7 +128,7 @@ func TestGetReflogCommits(t *testing.T) { { Sha: "c3c4b66b64c97ffeecde", Name: "checkout: moving from A to B", - Status: "reflog", + Status: models.StatusReflog, UnixTimestamp: 1643150483, Parents: []string{"51baa8c1"}, }, -- cgit v1.2.3