From e8bd94fa8a7274142f3bab1ce0ee867071fd30d2 Mon Sep 17 00:00:00 2001 From: fjuan <fjuan@splendeo.es> Date: Fri, 3 Feb 2012 12:32:19 +0100 Subject: [PATCH] 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' --- backup/Rakefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backup/Rakefile b/backup/Rakefile index 60eccece9..5e4964567 100644 --- a/backup/Rakefile +++ b/backup/Rakefile @@ -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 -- GitLab