summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2016-04-27 08:54:23 -0700
committerytti <saku@ytti.fi>2016-04-27 08:54:23 -0700
commit67a27faf0b27f13b1c4a7394a22a62cf52a83fda (patch)
treed7cddaa24346283e56aaaddf55264620d1b8d2dc
parent195ce83bd706c3b2a141f410f23dec11bcf21755 (diff)
parent60cd19857c2f722a1b39b8ee0f5b09440612d0ed (diff)
Merge pull request #407 from TibshoOT/fix_single_repo_with_group_and_git
Fix exception when using git, groups, and single_repo method
-rw-r--r--lib/oxidized/output/git.rb11
1 files changed, 7 insertions, 4 deletions
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