diff options
author | Saku Ytti <saku@ytti.fi> | 2015-04-20 18:56:25 +0300 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2015-04-20 18:56:25 +0300 |
commit | d1ea68e25624fb0a887a741fef49b6d91078b196 (patch) | |
tree | deff06d8aeb8ab01adcc14aefc39a8d62c849af2 | |
parent | b30522672bc67d8a391bede1307679dae3c9c6e1 (diff) |
support having all groups in single repo
output:
git:
single_repo: true
would cause repos to appear as directories in group
-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 |