Skip to content

Commit f9cd767

Browse files
author
root
committed
Fix #<TypeError: no implicit conversion of nil into String> when mirror doesn't need updates
1 parent 36000d0 commit f9cd767

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

Diff for: app/services/hooks/git_mirrors.rb

+14-10
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,18 @@ def execute(repository, payloads)
4141

4242

4343
def execute
44-
call_mirror if needs_push?
44+
y = ''
45+
46+
logger.info("Pushing changes to #{url} ... ")
47+
y << " - Pushing changes to #{url} ... "
48+
49+
if needs_push?
50+
y << call_mirror
51+
else
52+
y << "This mirror doesn't need to be updated\n"
53+
end
54+
55+
y
4556
end
4657

4758

@@ -72,23 +83,16 @@ def check_ref_spec
7283

7384

7485
def call_mirror
75-
y = ''
76-
77-
logger.info("Pushing changes to #{url} ... ")
78-
y << " - Pushing changes to #{url} ... "
79-
8086
push_failed, push_message = MirrorPush.new(mirror).call
8187

8288
if push_failed
8389
logger.error('Failed!')
8490
logger.error("#{push_message}")
85-
y << " [failure]\n"
91+
" [failure]\n"
8692
else
8793
logger.info('Succeeded!')
88-
y << " [success]\n"
94+
" [success]\n"
8995
end
90-
91-
y
9296
end
9397

9498

0 commit comments

Comments
 (0)