diff --git a/pkg/gui/presentation/commits_test.go b/pkg/gui/presentation/commits_test.go index 5c0100ea0..8f43da50d 100644 --- a/pkg/gui/presentation/commits_test.go +++ b/pkg/gui/presentation/commits_test.go @@ -58,8 +58,8 @@ func TestGetCommitListDisplayStrings(t *testing.T) { { testName: "some commits", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1"}, - {Name: "commit2", Hash: "sha2"}, + {Name: "commit1", Hash: "hash1"}, + {Name: "commit2", Hash: "hash2"}, }, startIdx: 0, endIdx: 2, @@ -68,15 +68,15 @@ func TestGetCommitListDisplayStrings(t *testing.T) { cherryPickedCommitHashSet: set.New[string](), now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha1 commit1 - sha2 commit2 + hash1 commit1 + hash2 commit2 `), }, { testName: "commit with tags", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1", Tags: []string{"tag1", "tag2"}}, - {Name: "commit2", Hash: "sha2"}, + {Name: "commit1", Hash: "hash1", Tags: []string{"tag1", "tag2"}}, + {Name: "commit2", Hash: "hash2"}, }, startIdx: 0, endIdx: 2, @@ -85,23 +85,23 @@ func TestGetCommitListDisplayStrings(t *testing.T) { cherryPickedCommitHashSet: set.New[string](), now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha1 tag1 tag2 commit1 - sha2 commit2 + hash1 tag1 tag2 commit1 + hash2 commit2 `), }, { testName: "show local branch head, except the current branch, main branches, or merged branches", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1"}, - {Name: "commit2", Hash: "sha2"}, - {Name: "commit3", Hash: "sha3"}, - {Name: "commit4", Hash: "sha4", Status: models.StatusMerged}, + {Name: "commit1", Hash: "hash1"}, + {Name: "commit2", Hash: "hash2"}, + {Name: "commit3", Hash: "hash3"}, + {Name: "commit4", Hash: "hash4", Status: models.StatusMerged}, }, branches: []*models.Branch{ - {Name: "current-branch", CommitHash: "sha1", Head: true}, - {Name: "other-branch", CommitHash: "sha2", Head: false}, - {Name: "master", CommitHash: "sha3", Head: false}, - {Name: "old-branch", CommitHash: "sha4", Head: false}, + {Name: "current-branch", CommitHash: "hash1", Head: true}, + {Name: "other-branch", CommitHash: "hash2", Head: false}, + {Name: "master", CommitHash: "hash3", Head: false}, + {Name: "old-branch", CommitHash: "hash4", Head: false}, }, currentBranchName: "current-branch", hasUpdateRefConfig: true, @@ -112,21 +112,21 @@ func TestGetCommitListDisplayStrings(t *testing.T) { cherryPickedCommitHashSet: set.New[string](), now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha1 commit1 - sha2 * commit2 - sha3 commit3 - sha4 commit4 + hash1 commit1 + hash2 * commit2 + hash3 commit3 + hash4 commit4 `), }, { testName: "show local branch head for head commit if updateRefs is on", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1"}, - {Name: "commit2", Hash: "sha2"}, + {Name: "commit1", Hash: "hash1"}, + {Name: "commit2", Hash: "hash2"}, }, branches: []*models.Branch{ - {Name: "current-branch", CommitHash: "sha1", Head: true}, - {Name: "other-branch", CommitHash: "sha1", Head: false}, + {Name: "current-branch", CommitHash: "hash1", Head: true}, + {Name: "other-branch", CommitHash: "hash1", Head: false}, }, currentBranchName: "current-branch", hasUpdateRefConfig: true, @@ -137,19 +137,19 @@ func TestGetCommitListDisplayStrings(t *testing.T) { cherryPickedCommitHashSet: set.New[string](), now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha1 * commit1 - sha2 commit2 + hash1 * commit1 + hash2 commit2 `), }, { testName: "don't show local branch head for head commit if updateRefs is off", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1"}, - {Name: "commit2", Hash: "sha2"}, + {Name: "commit1", Hash: "hash1"}, + {Name: "commit2", Hash: "hash2"}, }, branches: []*models.Branch{ - {Name: "current-branch", CommitHash: "sha1", Head: true}, - {Name: "other-branch", CommitHash: "sha1", Head: false}, + {Name: "current-branch", CommitHash: "hash1", Head: true}, + {Name: "other-branch", CommitHash: "hash1", Head: false}, }, currentBranchName: "current-branch", hasUpdateRefConfig: false, @@ -160,19 +160,19 @@ func TestGetCommitListDisplayStrings(t *testing.T) { cherryPickedCommitHashSet: set.New[string](), now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha1 commit1 - sha2 commit2 + hash1 commit1 + hash2 commit2 `), }, { testName: "show local branch head and tag if both exist", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1"}, - {Name: "commit2", Hash: "sha2", Tags: []string{"some-tag"}}, - {Name: "commit3", Hash: "sha3"}, + {Name: "commit1", Hash: "hash1"}, + {Name: "commit2", Hash: "hash2", Tags: []string{"some-tag"}}, + {Name: "commit3", Hash: "hash3"}, }, branches: []*models.Branch{ - {Name: "some-branch", CommitHash: "sha2"}, + {Name: "some-branch", CommitHash: "hash2"}, }, startIdx: 0, endIdx: 3, @@ -181,19 +181,19 @@ func TestGetCommitListDisplayStrings(t *testing.T) { cherryPickedCommitHashSet: set.New[string](), now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha1 commit1 - sha2 * some-tag commit2 - sha3 commit3 + hash1 commit1 + hash2 * some-tag commit2 + hash3 commit3 `), }, { testName: "showing graph", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}}, - {Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}}, - {Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, - {Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}}, - {Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, + {Name: "commit1", Hash: "hash1", Parents: []string{"hash2", "hash3"}}, + {Name: "commit2", Hash: "hash2", Parents: []string{"hash3"}}, + {Name: "commit3", Hash: "hash3", Parents: []string{"hash4"}}, + {Name: "commit4", Hash: "hash4", Parents: []string{"hash5"}}, + {Name: "commit5", Hash: "hash5", Parents: []string{"hash7"}}, }, startIdx: 0, endIdx: 5, @@ -202,21 +202,21 @@ func TestGetCommitListDisplayStrings(t *testing.T) { cherryPickedCommitHashSet: set.New[string](), now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha1 ⏣─╮ commit1 - sha2 ◯ │ commit2 - sha3 ◯─╯ commit3 - sha4 ◯ commit4 - sha5 ◯ commit5 + hash1 ⏣─╮ commit1 + hash2 ◯ │ commit2 + hash3 ◯─╯ commit3 + hash4 ◯ commit4 + hash5 ◯ commit5 `), }, { testName: "showing graph, including rebase commits", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, - {Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, - {Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, - {Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}}, - {Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, + {Name: "commit1", Hash: "hash1", Parents: []string{"hash2", "hash3"}, Action: todo.Pick}, + {Name: "commit2", Hash: "hash2", Parents: []string{"hash3"}, Action: todo.Pick}, + {Name: "commit3", Hash: "hash3", Parents: []string{"hash4"}}, + {Name: "commit4", Hash: "hash4", Parents: []string{"hash5"}}, + {Name: "commit5", Hash: "hash5", Parents: []string{"hash7"}}, }, startIdx: 0, endIdx: 5, @@ -226,21 +226,21 @@ func TestGetCommitListDisplayStrings(t *testing.T) { showYouAreHereLabel: true, now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha1 pick commit1 - sha2 pick commit2 - sha3 ◯ <-- YOU ARE HERE --- commit3 - sha4 ◯ commit4 - sha5 ◯ commit5 + hash1 pick commit1 + hash2 pick commit2 + hash3 ◯ <-- YOU ARE HERE --- commit3 + hash4 ◯ commit4 + hash5 ◯ commit5 `), }, { testName: "showing graph, including rebase commits, with offset", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, - {Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, - {Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, - {Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}}, - {Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, + {Name: "commit1", Hash: "hash1", Parents: []string{"hash2", "hash3"}, Action: todo.Pick}, + {Name: "commit2", Hash: "hash2", Parents: []string{"hash3"}, Action: todo.Pick}, + {Name: "commit3", Hash: "hash3", Parents: []string{"hash4"}}, + {Name: "commit4", Hash: "hash4", Parents: []string{"hash5"}}, + {Name: "commit5", Hash: "hash5", Parents: []string{"hash7"}}, }, startIdx: 1, endIdx: 5, @@ -250,20 +250,20 @@ func TestGetCommitListDisplayStrings(t *testing.T) { showYouAreHereLabel: true, now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha2 pick commit2 - sha3 ◯ <-- YOU ARE HERE --- commit3 - sha4 ◯ commit4 - sha5 ◯ commit5 + hash2 pick commit2 + hash3 ◯ <-- YOU ARE HERE --- commit3 + hash4 ◯ commit4 + hash5 ◯ commit5 `), }, { testName: "startIdx is past TODO commits", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, - {Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, - {Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, - {Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}}, - {Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, + {Name: "commit1", Hash: "hash1", Parents: []string{"hash2", "hash3"}, Action: todo.Pick}, + {Name: "commit2", Hash: "hash2", Parents: []string{"hash3"}, Action: todo.Pick}, + {Name: "commit3", Hash: "hash3", Parents: []string{"hash4"}}, + {Name: "commit4", Hash: "hash4", Parents: []string{"hash5"}}, + {Name: "commit5", Hash: "hash5", Parents: []string{"hash7"}}, }, startIdx: 3, endIdx: 5, @@ -273,18 +273,18 @@ func TestGetCommitListDisplayStrings(t *testing.T) { showYouAreHereLabel: true, now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha4 ◯ commit4 - sha5 ◯ commit5 + hash4 ◯ commit4 + hash5 ◯ commit5 `), }, { testName: "only showing TODO commits", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, - {Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, - {Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, - {Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}}, - {Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, + {Name: "commit1", Hash: "hash1", Parents: []string{"hash2", "hash3"}, Action: todo.Pick}, + {Name: "commit2", Hash: "hash2", Parents: []string{"hash3"}, Action: todo.Pick}, + {Name: "commit3", Hash: "hash3", Parents: []string{"hash4"}}, + {Name: "commit4", Hash: "hash4", Parents: []string{"hash5"}}, + {Name: "commit5", Hash: "hash5", Parents: []string{"hash7"}}, }, startIdx: 0, endIdx: 2, @@ -294,18 +294,18 @@ func TestGetCommitListDisplayStrings(t *testing.T) { showYouAreHereLabel: true, now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha1 pick commit1 - sha2 pick commit2 + hash1 pick commit1 + hash2 pick commit2 `), }, { testName: "no TODO commits, towards bottom", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}}, - {Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}}, - {Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, - {Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}}, - {Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, + {Name: "commit1", Hash: "hash1", Parents: []string{"hash2", "hash3"}}, + {Name: "commit2", Hash: "hash2", Parents: []string{"hash3"}}, + {Name: "commit3", Hash: "hash3", Parents: []string{"hash4"}}, + {Name: "commit4", Hash: "hash4", Parents: []string{"hash5"}}, + {Name: "commit5", Hash: "hash5", Parents: []string{"hash7"}}, }, startIdx: 4, endIdx: 5, @@ -315,17 +315,17 @@ func TestGetCommitListDisplayStrings(t *testing.T) { showYouAreHereLabel: true, now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha5 ◯ commit5 + hash5 ◯ commit5 `), }, { testName: "only TODO commits except last", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, - {Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, - {Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}, Action: todo.Pick}, - {Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}, Action: todo.Pick}, - {Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, + {Name: "commit1", Hash: "hash1", Parents: []string{"hash2", "hash3"}, Action: todo.Pick}, + {Name: "commit2", Hash: "hash2", Parents: []string{"hash3"}, Action: todo.Pick}, + {Name: "commit3", Hash: "hash3", Parents: []string{"hash4"}, Action: todo.Pick}, + {Name: "commit4", Hash: "hash4", Parents: []string{"hash5"}, Action: todo.Pick}, + {Name: "commit5", Hash: "hash5", Parents: []string{"hash7"}}, }, startIdx: 0, endIdx: 2, @@ -335,16 +335,16 @@ func TestGetCommitListDisplayStrings(t *testing.T) { showYouAreHereLabel: true, now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha1 pick commit1 - sha2 pick commit2 + hash1 pick commit1 + hash2 pick commit2 `), }, { testName: "don't show YOU ARE HERE label when not asked for (e.g. in branches panel)", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1", Parents: []string{"sha2"}, Action: todo.Pick}, - {Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}}, - {Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, + {Name: "commit1", Hash: "hash1", Parents: []string{"hash2"}, Action: todo.Pick}, + {Name: "commit2", Hash: "hash2", Parents: []string{"hash3"}}, + {Name: "commit3", Hash: "hash3", Parents: []string{"hash4"}}, }, startIdx: 0, endIdx: 3, @@ -354,16 +354,16 @@ func TestGetCommitListDisplayStrings(t *testing.T) { showYouAreHereLabel: false, now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), expected: formatExpected(` - sha1 pick commit1 - sha2 ◯ commit2 - sha3 ◯ commit3 + hash1 pick commit1 + hash2 ◯ commit2 + hash3 ◯ commit3 `), }, { testName: "custom time format", commits: []*models.Commit{ - {Name: "commit1", Hash: "sha1", UnixTimestamp: 1577844184, AuthorName: "Jesse Duffield"}, - {Name: "commit2", Hash: "sha2", UnixTimestamp: 1576844184, AuthorName: "Jesse Duffield"}, + {Name: "commit1", Hash: "hash1", UnixTimestamp: 1577844184, AuthorName: "Jesse Duffield"}, + {Name: "commit2", Hash: "hash2", UnixTimestamp: 1576844184, AuthorName: "Jesse Duffield"}, }, fullDescription: true, timeFormat: "2006-01-02", @@ -375,8 +375,8 @@ func TestGetCommitListDisplayStrings(t *testing.T) { cherryPickedCommitHashSet: set.New[string](), now: time.Date(2020, 1, 1, 5, 3, 4, 0, time.UTC), expected: formatExpected(` - sha1 2:03AM Jesse Duffield commit1 - sha2 2019-12-20 Jesse Duffield commit2 + hash1 2:03AM Jesse Duffield commit1 + hash2 2019-12-20 Jesse Duffield commit2 `), }, }