Skip to content

Commit 0f1e729

Browse files
authored
Merge pull request #123 from blackducksoftware/OTWO-6189
OTWO-6189 Made Branch Mandatory for Git SCM
2 parents 8c91d19 + 2e378e2 commit 0f1e729

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

lib/ohloh_scm/git/validation.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
module OhlohScm
44
module Git
55
class Validation < OhlohScm::Validation
6+
def validate
7+
super
8+
@errors << [:branch_name, 'Invalid Branch Name.'] if scm.branch_name.to_s.empty?
9+
end
10+
611
private
712

813
def validate_server_connection
9-
msg = "The server did not respond to the 'git-ls-remote' command. Is the URL correct?"
14+
msg = "The server did not respond to the 'git-ls-remote' command."
15+
msg << ' Are the URL and Branch fields correct?'
1016
@errors << [:failed, msg] unless status.exist?
1117
end
1218

lib/ohloh_scm/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module OhlohScm
44
module Version
5-
STRING = '3.0.9'
5+
STRING = '3.0.10'
66
GIT = '2.17.1'
77
SVN = '1.9.7'
88
CVSNT = '2.5.04'

spec/ohloh_scm/git/validation_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
core.errors.must_be :empty?
88
end
99

10+
it 'must have errors for no branch_name' do
11+
get_core(:git, branch_name: '').validation.send(:branch_name_errors).wont_be :empty?
12+
end
13+
1014
it 'must have errors for invalid branch_name' do
1115
get_core(:git, branch_name: 'x' * 81).validation.send(:branch_name_errors).wont_be :empty?
1216
get_core(:git, branch_name: 'foo@bar').validation.send(:branch_name_errors).wont_be :empty?

0 commit comments

Comments
 (0)