Skip to content

Commit c7b6821

Browse files
committed
Prefer guard clause
1 parent d099494 commit c7b6821

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

app/services/github_hook/updater.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,13 @@ def time_diff_milli(start, finish)
142142
# Fetches updates from the remote repository
143143
def update_repository(repository)
144144
command = git_command("fetch origin")
145-
if exec(command, repository.url)
146-
command = git_command(
147-
"fetch --prune origin \"+refs/heads/*:refs/heads/*\""
148-
)
149-
exec(command, repository.url)
150-
end
145+
fetch = exec(command, repository.url)
146+
return nil unless fetch
147+
148+
command = git_command(
149+
"fetch --prune origin \"+refs/heads/*:refs/heads/*\""
150+
)
151+
exec(command, repository.url)
151152
end
152153
end
153154
end

0 commit comments

Comments
 (0)