Skip to content

Commit 025fa29

Browse files
authored
Refactor LocalReleaseBranchDoesNotExist#assert (#24)
1 parent 7880c89 commit 025fa29

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/create_github_release/assertions/local_release_branch_does_not_exist.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ class LocalReleaseBranchDoesNotExist < AssertionBase
3131
def assert
3232
print "Checking that local branch ' #{options.branch}' does not exist..."
3333

34-
if `git branch --list '#{options.branch}' | wc -l`.to_i.zero? && $CHILD_STATUS.success?
34+
branch_count = `git branch --list '#{options.branch}' | wc -l`.to_i
35+
error 'Could not list branches' unless $CHILD_STATUS.success?
36+
37+
if branch_count.zero?
3538
puts 'OK'
3639
else
37-
error 'Could not list branches' unless $CHILD_STATUS.success?
3840
error "'#{options.branch}' already exists."
3941
end
4042
end

0 commit comments

Comments
 (0)