Skip to content

Commit

Permalink
Print message to stderr when running on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rymuszka committed Jun 8, 2022
1 parent aac280a commit 997668e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/cli/list_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var listDiffCmd = &cobra.Command{
gitDiffSet := git.NewDiffSet(defaultBranch, defaultRange, branchRange, onTags)

if gitDiffSet.IsEvaluationNeeded() {
fmt.Println("Running on a tag, skipping evaluation.")
println("Listing diffs for tags is not supported.")
return
}

Expand Down
9 changes: 7 additions & 2 deletions test/e2e/list_diff_on_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,20 @@

repo.run(%{
export SEMAPHORE_GIT_REF_TYPE=tag
#{spc} list-diff > /tmp/output.txt
#{spc} list-diff 1>/tmp/output.txt 2>/tmp/error.txt
})

output = File.readlines('/tmp/output.txt')
.map { |line| line.strip }
.reject { |line| line.empty? }

error = File.readlines('/tmp/error.txt')
.map { |line| line.strip }
.reject { |line| line.empty? }

assert_eq($?.exitstatus, 0)
assert_eq(["Running on a tag, skipping evaluation."], output)
assert_eq([], output)
assert_eq(["Running on a tag, skipping evaluation."], error)

repo.run(%{
export SEMAPHORE_GIT_REF_TYPE=branch
Expand Down

0 comments on commit 997668e

Please sign in to comment.