Commit e8bd94fa authored by Francisco Juan's avatar Francisco Juan

Backup git repositories with --bare option and fetching all branches on syncing

Update git command for initialization of repositories with the --bare option
Change syncing git repositories command from 'git clone' to 'git fetch'
parent c8009ede
......@@ -193,13 +193,13 @@ end
def init_git_repository(repository)
title "Initializing git repository #{repository}", 2
path = File.join(LOCAL_GIT_PATH)
shell "cd #{path} && git clone #{repository}"
shell "cd #{path} && git clone --bare #{repository}"
end
def sync_git_repository(repository)
title "Syncing repository #{repository}", 2
path = File.join(LOCAL_GIT_PATH, repository)
shell "cd #{path} && git pull"
shell "cd #{path} && git fetch origin"
end
def rdiff_get(source, destination)
......@@ -240,7 +240,7 @@ namespace :backup do
file = File.new(LOCAL_GITLIST_PATH, "r")
while (repository = file.gets)
repository.strip!
repository_folder = repository.split('/').last.gsub('.git','')
repository_folder = repository.split('/').last
init_git_repository(repository) unless git_exists?(repository_folder)
sync_git_repository(repository_folder)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment