Skip to content

Commit

Permalink
Extract git command building to their own method to reduce duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
koppen committed Jan 27, 2011
1 parent 57fe7cf commit 039dd45
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/controllers/github_hook_controller.rb
Expand Up @@ -31,9 +31,13 @@ def exec(command)
logger.debug { "GithubHook: * STDERR: #{output}"}
end

def git_command(command, repository)
"git --verbose --git-dir='#{repository.url}' #{command}"
end

# Fetches updates from the remote repository
def update_repository(repository)
command = "git --verbose --git-dir='#{repository.url}' fetch origin && git --verbose --git-dir='#{repository.url}' reset --soft refs/remotes/origin/master"
command = git_command('fetch origin', repository) + ' && ' + git_command('reset --soft refs/remotes/origin/master', repository)
exec(command)
end

Expand Down

0 comments on commit 039dd45

Please sign in to comment.