From 60cd19857c2f722a1b39b8ee0f5b09440612d0ed Mon Sep 17 00:00:00 2001 From: TibshoOT Date: Wed, 27 Apr 2016 12:38:25 +0200 Subject: Fix exception when using git, groups, and single_repo method --- lib/oxidized/output/git.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/output/git.rb b/lib/oxidized/output/git.rb index 8b605f6..3678126 100644 --- a/lib/oxidized/output/git.rb +++ b/lib/oxidized/output/git.rb @@ -70,7 +70,10 @@ class Git < Output def version node, group begin repo = @cfg.repo - if group + path = node + if group and @cfg.single_repo? + path = "#{group}/#{node}" + elsif group repo = File.join File.dirname(repo), group + '.git' end repo = Rugged::Repository.new repo @@ -80,7 +83,7 @@ class Git < Output i = -1 tab = [] walker.each do |commit| - if commit.diff(paths: [node]).size > 0 + if commit.diff(paths: [path]).size > 0 hash = {} hash[:date] = commit.time.to_s hash[:oid] = commit.oid @@ -100,7 +103,7 @@ class Git < Output def get_version node, group, oid begin repo = @cfg.repo - if group && group != '' + if group && group != '' && !@cfg.single_repo? repo = File.join File.dirname(repo), group + '.git' end repo = Rugged::Repository.new repo @@ -115,7 +118,7 @@ class Git < Output begin repo = @cfg.repo diff_commits = nil - if group && group != '' + if group && group != '' && !@cfg.single_repo? repo = File.join File.dirname(repo), group + '.git' end repo = Rugged::Repository.new repo -- cgit v1.2.1