From 215cc4074083a65ebd9d3189532073882afd75e3 Mon Sep 17 00:00:00 2001 From: jwhited Date: Sun, 5 Jul 2015 16:17:39 -0700 Subject: fix fetching when groups are used and single_repo: true --- lib/oxidized/output/git.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/oxidized/output') 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 -- cgit v1.2.1 From a880f2a3cbabff9561aa0e99c3eca6e33775916d Mon Sep 17 00:00:00 2001 From: jwhited Date: Mon, 6 Jul 2015 12:38:26 -0700 Subject: fix fetch for groups when single_repo: true --- lib/oxidized/output/git.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/oxidized/output') diff --git a/lib/oxidized/output/git.rb b/lib/oxidized/output/git.rb index 2678e3a..b1212f1 100644 --- a/lib/oxidized/output/git.rb +++ b/lib/oxidized/output/git.rb @@ -50,17 +50,13 @@ class Git < Output def fetch node, group begin repo = @cfg.repo - if (group && !@cfg.single_repo?) - repo = File.join File.dirname(repo), group + '.git' - end + repo = File.join File.dirname(repo), group + '.git' if group and not @cfg.single_repo? repo = Rugged::Repository.new repo index = repo.index index.read_tree repo.head.target.tree unless repo.empty? - if (group && @cfg.single_repo?) - repo.read(index.get(group + '/' + node)[:oid]).data - else - repo.read(index.get(node)[:oid]).data - end + file = node + file = File.join(group, node) if group and @cfg.single_repo? + repo.read(index.get(file)[:oid]).data rescue 'node not found' end -- cgit v1.2.1