summaryrefslogtreecommitdiffstats
path: root/bin/gitr
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.(none)>2007-11-27 08:42:26 -0800
committerscott Chacon <schacon@agadorsparticus.(none)>2007-11-27 08:42:26 -0800
commit6bbead02aa2a60e7d50e68f3b2c98a14c26b2d81 (patch)
tree6233897a4ff9b1eec589d47a5a4a5eee458fa19f /bin/gitr
parentb7a7d204bad7de8696ac800c3d1e608bdc344a38 (diff)
downloadthird_party-ruby-git-6bbead02aa2a60e7d50e68f3b2c98a14c26b2d81.zip
third_party-ruby-git-6bbead02aa2a60e7d50e68f3b2c98a14c26b2d81.tar.gz
third_party-ruby-git-6bbead02aa2a60e7d50e68f3b2c98a14c26b2d81.tar.xz
added ls-tree to gitr
Diffstat (limited to 'bin/gitr')
-rwxr-xr-xbin/gitr31
1 files changed, 20 insertions, 11 deletions
diff --git a/bin/gitr b/bin/gitr
index 53c8055..bf1e192 100755
--- a/bin/gitr
+++ b/bin/gitr
@@ -12,9 +12,9 @@
# add --log-file
# add --help
-#require 'lib/git'
-require 'rubygems'
-require 'git'
+require 'lib/git'
+#require 'rubygems'
+#require 'git'
require 'logger'
command = ARGV[0]
@@ -25,15 +25,17 @@ if !command
puts
puts 'commands: log'
puts ' log-shas'
- puts ' cat-file'
- puts ' rev-parse'
+ puts ' cat-file (treeish)'
+ puts ' rev-parse (treeish)'
puts ' branches'
puts ' config'
+ puts ' ls-tree (tree)'
exit
end
git_dir = ENV['GIT_DIR'] || '.git'
-@git = Git.bare(git_dir, :log => Logger.new(STDOUT))
+#@git = Git.bare(git_dir, :log => Logger.new(STDOUT))
+@git = Git.bare(git_dir)
case command
when 'log'
@@ -60,10 +62,17 @@ when 'config'
@git.config.sort.each do |k,v|
puts "#{k} : #{v}"
end
+when 'ls-tree'
+ # gitr ls-tree
+ tree = @git.gtree(ARGV[1])
+ tree.blobs.sort.each do |name, c|
+ puts [[c.mode, c.type, c.sha].join(" "), name].join("\t")
+ end
+ tree.trees.sort.each do |name, c|
+ puts [[c.mode, c.type, c.sha].join(" "), name].join("\t")
+ end
end
-# gitr ls-tree
-# gitr pack-browse
-
-# gitr diff / stats ?
-# output in yaml? \ No newline at end of file
+# todo:
+# gitr pack-browse
+# gitr diff / stats ?