diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/oxidized/output/git.rb | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/oxidized/output/git.rb b/lib/oxidized/output/git.rb index e9256e8..64497c9 100644 --- a/lib/oxidized/output/git.rb +++ b/lib/oxidized/output/git.rb @@ -68,17 +68,23 @@ class Git < Output def update repo, file, data return if data.empty? if @opt[:group] - repo = File.join File.dirname(repo), @opt[:group] + '.git' + if @cfg.single_repo? + file = File.join @opt[:group], file + else + repo = File.join File.dirname(repo), @opt[:group] + '.git' + end end - repo = Rugged::Repository.new repo - update_repo repo, file, data, @msg, @user, @email - rescue Rugged::OSError, Rugged::RepositoryError => open_error begin - Rugged::Repository.init_at repo, :bare - rescue => create_error - raise GitError, "first '#{open_error.message}' was raised while opening git repo, then '#{create_error.message}' was while trying to create git repo" + repo = Rugged::Repository.new repo + update_repo repo, file, data, @msg, @user, @email + rescue Rugged::OSError, Rugged::RepositoryError => open_error + begin + Rugged::Repository.init_at repo, :bare + rescue => create_error + raise GitError, "first '#{open_error.message}' was raised while opening git repo, then '#{create_error.message}' was while trying to create git repo" + end + retry end - retry end def update_repo repo, file, data, msg, user, email |