From eb965fb8250986f76a009cc2d755af8286e29766 Mon Sep 17 00:00:00 2001 From: Matthias Lederhofer Date: Tue, 23 Jan 2007 16:24:56 +0100 Subject: [PATCH] git.rb: test code showing the content of objects --- git.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/git.rb b/git.rb index d1d92fb..d8e4185 100644 --- a/git.rb +++ b/git.rb @@ -42,3 +42,26 @@ module Git end end end + +if $0 == __FILE__ + require 'git' + r = Git::Repository.new(ARGV[0]) + ARGV[1..-1].each do |sha1| + o = r.get_object_by_sha1(sha1) + if !o + puts 'no such object' + next + end + puts o.type + case o.type + when :blob + puts o.content + when :tree + puts o.entry.collect { |e| "%s %s" % [e.sha1, e.name] }.join("\n") + when :commit + puts o.raw_content + when :tag + puts o.raw_content + end + end +end -- 2.11.4.GIT