summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Vriesman <glenn.vriesman@gmail.com>2020-02-06 15:07:43 +0100
committerJesse Duffield <jessedduffield@gmail.com>2020-02-09 23:47:22 +1100
commitd9eb6e26823bd001d4e50c1343f810cd31bab566 (patch)
tree791f25ebe93ab6326c59f1e6d911cad31490d630
parentb74107f2baec4727f794df50df73dbce0cc48cc2 (diff)
Fixed tests
Signed-off-by: Glenn Vriesman <glenn.vriesman@gmail.com>
-rw-r--r--pkg/commands/commit_list_builder.go1
-rw-r--r--pkg/commands/commit_list_builder_test.go10
2 files changed, 5 insertions, 6 deletions
diff --git a/pkg/commands/commit_list_builder.go b/pkg/commands/commit_list_builder.go
index 1c22ff711..73d52e4f7 100644
--- a/pkg/commands/commit_list_builder.go
+++ b/pkg/commands/commit_list_builder.go
@@ -288,7 +288,6 @@ func (c *CommitListBuilder) getLog(limit bool) string {
limitFlag = "-30"
}
- c.Log.Warn(fmt.Sprintf("git log --oneline %s --abbrev=%d", limitFlag, 20))
result, err := c.OSCommand.RunCommandWithOutput(fmt.Sprintf("git log --oneline %s --abbrev=%d", limitFlag, 20))
if err != nil {
// assume if there is an error there are no commits yet for this branch
diff --git a/pkg/commands/commit_list_builder_test.go b/pkg/commands/commit_list_builder_test.go
index 8b843d849..e23bc5308 100644
--- a/pkg/commands/commit_list_builder_test.go
+++ b/pkg/commands/commit_list_builder_test.go
@@ -163,7 +163,7 @@ func TestCommitListBuilderGetLog(t *testing.T) {
"Retrieves logs",
func(cmd string, args ...string) *exec.Cmd {
assert.EqualValues(t, "git", cmd)
- assert.EqualValues(t, []string{"log", "--oneline", "-30"}, args)
+ assert.EqualValues(t, []string{"log", "--oneline", "-30", "--abbrev=20"}, args)
return exec.Command("echo", "6f0b32f commands/git : add GetCommits tests refactor\n9d9d775 circle : remove new line")
},
@@ -175,7 +175,7 @@ func TestCommitListBuilderGetLog(t *testing.T) {
"An error occurred when retrieving logs",
func(cmd string, args ...string) *exec.Cmd {
assert.EqualValues(t, "git", cmd)
- assert.EqualValues(t, []string{"log", "--oneline", "-30"}, args)
+ assert.EqualValues(t, []string{"log", "--oneline", "-30", "--abbrev=20"}, args)
return exec.Command("test")
},
func(output string) {
@@ -212,7 +212,7 @@ func TestCommitListBuilderGetCommits(t *testing.T) {
assert.EqualValues(t, []string{"rev-list", "@{u}..HEAD", "--abbrev-commit"}, args)
return exec.Command("echo")
case "log":
- assert.EqualValues(t, []string{"log", "--oneline", "-30"}, args)
+ assert.EqualValues(t, []string{"log", "--oneline", "-30", "--abbrev=20"}, args)
return exec.Command("echo")
case "merge-base":
assert.EqualValues(t, []string{"merge-base", "HEAD", "master"}, args)
@@ -239,7 +239,7 @@ func TestCommitListBuilderGetCommits(t *testing.T) {
assert.EqualValues(t, []string{"rev-list", "@{u}..HEAD", "--abbrev-commit"}, args)
return exec.Command("echo", "8a2bb0e")
case "log":
- assert.EqualValues(t, []string{"log", "--oneline", "-30"}, args)
+ assert.EqualValues(t, []string{"log", "--oneline", "-30", "--abbrev=20"}, args)
return exec.Command("echo", "8a2bb0e commit 1\n78976bc commit 2")
case "merge-base":
assert.EqualValues(t, []string{"merge-base", "HEAD", "master"}, args)
@@ -280,7 +280,7 @@ func TestCommitListBuilderGetCommits(t *testing.T) {
assert.EqualValues(t, []string{"rev-list", "@{u}..HEAD", "--abbrev-commit"}, args)
return exec.Command("echo", "8a2bb0e")
case "log":
- assert.EqualValues(t, []string{"log", "--oneline", "-30"}, args)
+ assert.EqualValues(t, []string{"log", "--oneline", "-30", "--abbrev=20"}, args)
return exec.Command("echo", "8a2bb0e commit 1\n78976bc commit 2")
case "merge-base":
assert.EqualValues(t, []string{"merge-base", "HEAD", "master"}, args)