Skip to content

Commit 7da6a12

Browse files
committed
Deal with nil branch
default_branch doesn't guarantee a result. This checks for the nil value and raises an exception.
1 parent 44b3e75 commit 7da6a12

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/modulesync/repository.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ def default_branch
3939
def switch_branch(branch)
4040
unless branch
4141
branch = default_branch
42+
unless branch
43+
raise "Unable to detect default branch"
44+
end
4245
puts "Using repository's default branch: #{branch}"
4346
end
4447
return if repo.current_branch == branch

0 commit comments

Comments
 (0)