summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwhited <jwhited0917@gmail.com>2015-07-05 16:17:39 -0700
committerjwhited <jwhited0917@gmail.com>2015-07-05 16:17:39 -0700
commit215cc4074083a65ebd9d3189532073882afd75e3 (patch)
treef451ec8c506da38d2c16344230a87128cf3dbfbe
parent4251ab700db12b0cf0197d1d43caa57a80ac214e (diff)
fix fetching when groups are used and single_repo: true
-rw-r--r--lib/oxidized/output/git.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/oxidized/output/git.rb b/lib/oxidized/output/git.rb
index 46e748a..2678e3a 100644
--- a/lib/oxidized/output/git.rb
+++ b/lib/oxidized/output/git.rb
@@ -50,13 +50,17 @@ class Git < Output
def fetch node, group
begin
repo = @cfg.repo
- if group
+ if (group && !@cfg.single_repo?)
repo = File.join File.dirname(repo), group + '.git'
end
repo = Rugged::Repository.new repo
index = repo.index
index.read_tree repo.head.target.tree unless repo.empty?
- repo.read(index.get(node)[:oid]).data
+ if (group && @cfg.single_repo?)
+ repo.read(index.get(group + '/' + node)[:oid]).data
+ else
+ repo.read(index.get(node)[:oid]).data
+ end
rescue
'node not found'
end