Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

moved project

  • Loading branch information...
commit ef2f2c0061a753d3303c54ff59402333ace46d97 1 parent bda6513
Scott Chacon authored
Showing with 4 additions and 829 deletions.
  1. +0 −13 API
  2. +0 −21 LICENSE
  3. +4 −88 README.md
  4. +0 −107 Rakefile
  5. +0 −64 benchmarks.rb
  6. +0 −9 ext/ribbit/extconf.rb
  7. +0 −255 ext/ribbit/ribbit.c
  8. +0 −3  lib/ribbit/version.rb
  9. +0 −20 ribbit.gemspec
  10. +0 −1  test/fixtures/testrepo.git/HEAD
  11. +0 −6 test/fixtures/testrepo.git/config
  12. +0 −1  test/fixtures/testrepo.git/description
  13. BIN  test/fixtures/testrepo.git/index
  14. +0 −6 test/fixtures/testrepo.git/info/exclude
  15. +0 −2  test/fixtures/testrepo.git/logs/HEAD
  16. +0 −2  test/fixtures/testrepo.git/logs/refs/heads/master
  17. BIN  test/fixtures/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08
  18. BIN  test/fixtures/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7
  19. BIN  test/fixtures/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd
  20. BIN  test/fixtures/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057
  21. +0 −2  test/fixtures/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045
  22. +0 −2  test/fixtures/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644
  23. BIN  test/fixtures/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a
  24. BIN  test/fixtures/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d
  25. BIN  test/fixtures/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479
  26. +0 −3  test/fixtures/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a
  27. +0 −2  test/fixtures/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f
  28. BIN  test/fixtures/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd
  29. BIN  test/fixtures/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6
  30. +0 −3  test/fixtures/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644
  31. +0 −3  test/fixtures/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd
  32. BIN  test/fixtures/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
  33. BIN  test/fixtures/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1
  34. BIN  test/fixtures/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92
  35. BIN  test/fixtures/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765
  36. BIN  test/fixtures/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx
  37. BIN  test/fixtures/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack
  38. +0 −2  test/fixtures/testrepo.git/packed-refs
  39. +0 −1  test/fixtures/testrepo.git/refs/heads/master
  40. +0 −33 test/lib_test.rb
  41. +0 −22 test/odb_pack_test.rb
  42. +0 −56 test/odb_test.rb
  43. +0 −27 test/test_helper.rb
  44. +0 −75 test/walker_test.rb
13 API
View
@@ -1,13 +0,0 @@
-= General Library
-
-Ribbit::Lib
- * hex_to_raw(SHA_HEX)
- * raw_to_hex(SHA_RAW)
-
-
-= Object Database Class
-
-Ribbit::Odb
- * new(path)
- - exists(SHA_HEX)
-
21 LICENSE
View
@@ -1,21 +0,0 @@
-The MIT License
-
-Copyright (c) 2010 Scott Chacon
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
92 README.md
View
@@ -1,90 +1,6 @@
-Ribbit - libgit2 bindings in Ruby
-===================================
+= Moved =
-Ribbit is a Ruby bindings to the libgit2 linkable C Git library. This is
-for testing and using the libgit2 library in a language that is awesome.
-
-INSTALLING AND RUNNING
-========================
-
-First you need to install libgit2:
-
- $ git clone git://repo.or.cz/libgit2.git
- $ cd libgit2
- $ make
- $ make install
-
-Next, you need to install rake-compiler:
-
- $ sudo gem install rake-compiler
-
-Now that those are installed, you can install Ribbit:
-
- $ git clone git://github.com/schacon/ribbit.git
- $ cd ribbit
- $ rake compile
- $ rake test
-
-
-API
-==============
-
-There is a general library for some basic Gitty methods. So far, just converting
-a raw sha (20 bytes) into a readable hex sha (40 char).
-
- raw = Ribbit::Lib.hex_to_raw(hex_sha)
- hex = Ribbit::Lib.raw_to_hex(20_byte_raw_sha)
-
-There is an Odb class that you can instantiate with a path (currently the 'objects'
-path in the .git directory, but I'll probably change that soon - patch, anybody?).
-This lets you check for objects, read raw object data, write raw object data and
-get a hash (SHA1 checksum) of what contents would be without writing them out.
-
- odb = Ribbit::Odb.new("/opt/repo.git/objects") # takes the object path, currently
-
- bool = odb.exists(hex_sha)
- data, length, type = odb.read(hex_sha) # or false if object does not exist
- hex_sha = odb.hash(content, type) # 'commit', 'blob', 'tree', 'tag'
- hex_sha = odb.write("my content\n", "blob")
-
-Finally, there is a Walker class that currently takes an object path (probably will
-eventually change this to just be instantiated from an Odb, like `walker = odb.walker`
-rather than seperately instantiated with the same path). You can push head SHAs
-onto the walker, then call next to get a list of the reachable commit objects, one
-at a time. You can also hide() commits if you are not interested in anything beneath
-them (useful for a `git log master ^origin/master` type deal).
-
- walker = Ribbit::Walker.new(path) # also takes object path
-
- walker.push(hex_sha_interesting)
- walker.hide(hex_sha_uninteresting)
- hex_sha = walker.next # false if none left
- walker.reset
-
-
-TODO
-==============
-
-I will try to keep this up to date with the working public API available in
-the libgit2 linkable library. Whatever is available there should be here
-as well.
-
-
-CONTRIBUTING
-==============
-
-Fork schacon/ribbit on GitHub, make it awesomer (preferably in a branch named
-for the topic), send a pull request.
-
-
-AUTHORS
-==============
-
-Scott Chacon <schacon@gmail.com>
-
-
-LICENSE
-==============
-
-MIT.
+This project has been moved to http://github.com/libgit2/ribbit
+Thanks!
+Scott
107 Rakefile
View
@@ -1,107 +0,0 @@
-# stolen largely from defunkt/mustache
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'rake/extensiontask'
-
-Rake::ExtensionTask.new('ribbit')
-
-#
-# Helpers
-#
-
-def command?(command)
- system("type #{command} > /dev/null")
-end
-
-
-#
-# Tests
-#
-
-task :default => :test
-
-if command? :turn
- desc "Run tests"
- task :test do
- suffix = "-n #{ENV['TEST']}" if ENV['TEST']
- sh "turn test/*.rb #{suffix}"
- end
-else
- Rake::TestTask.new do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = false
- end
-end
-
-if command? :kicker
- desc "Launch Kicker (like autotest)"
- task :kicker do
- puts "Kicking... (ctrl+c to cancel)"
- exec "kicker -e rake test lib examples"
- end
-end
-
-
-#
-# Ron
-#
-
-if command? :ronn
- desc "Show the manual"
- task :man => "man:build" do
- exec "man man/mustache.1"
- end
-
- desc "Build the manual"
- task "man:build" do
- sh "ronn -br5 --organization=SCHACON --manual='Ribbit Manual' man/*.ron"
- end
-end
-
-
-#
-# Gems
-#
-
-begin
- require 'mg'
- MG.new("ribbit.gemspec")
-
- desc "Push a new version to Gemcutter and publish docs."
- task :publish => "gem:publish" do
- require File.dirname(__FILE__) + '/lib/mustache/version'
-
- system "git tag v#{Ribbit::Version}"
- sh "git push origin master --tags"
- sh "git clean -fd"
- exec "rake pages"
- end
-rescue LoadError
- warn "mg not available."
- warn "Install it with: gem i mg"
-end
-
-#
-# Documentation
-#
-
-desc "Publish to GitHub Pages"
-task :pages => [ "man:build" ] do
- Dir['man/*.html'].each do |f|
- cp f, File.basename(f).sub('.html', '.newhtml')
- end
-
- `git commit -am 'generated manual'`
- `git checkout site`
-
- Dir['*.newhtml'].each do |f|
- mv f, f.sub('.newhtml', '.html')
- end
-
- `git add .`
- `git commit -m updated`
- `git push site site:master`
- `git checkout master`
- puts :done
-end
64 benchmarks.rb
View
@@ -1,64 +0,0 @@
-require 'benchmark'
-require 'rubygems'
-require 'grit'
-require 'pp'
-
-dir = File.dirname(File.expand_path(__FILE__))
-$LOAD_PATH.unshift dir + '/lib'
-require 'ribbit'
-
-n = 5000
-
-sha = "8496071c1b46c854b31185ea97743be6a8774479"
-psha = "41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9"
-raw = Ribbit::Lib.hex_to_raw(sha)
-
-repo = File.dirname(File.expand_path(__FILE__)) + "/test/fixtures/testrepo.git"
-
-psha = "f7c7e7614af3d26a05aeb324528b6d42076c4e6d"
-sha = "78af21ad7104d6f64b46cbc87f6ca944b8f412da"
-repo = "/Users/schacon/projects/github/.git"
-
-Benchmark.bm do |x|
-
- @grit = Grit::Repo.new(repo).git
- @ribbit = Ribbit::Odb.new(repo + '/objects')
-
- x.report("Grit object_exists? loose ") do
- @grit = Grit::Repo.new(repo).git
- 1.upto(n) { @grit.object_exists?(sha) }
- end
- x.report("Grit object_exists? packed") do
- @grit = Grit::Repo.new(repo).git
- 1.upto(n) { @grit.object_exists?(psha) }
- end
- x.report("Ribbit object_exists? loose ") do
- @ribbit = Ribbit::Odb.new(repo + '/objects')
- 1.upto(n) { @ribbit.exists(sha) }
- end
- x.report("Ribbit object_exists? packed") do
- @ribbit = Ribbit::Odb.new(repo + '/objects')
- 1.upto(n) { @ribbit.exists(psha) }
- end
-
-end
-
-exit
-
-n = 50000
-
-Benchmark.bm do |x|
-
- x.report("Ribbit Hex2Raw:") do
- 1.upto(n) { Ribbit::Lib.hex_to_raw(sha) }
- end
- x.report("Ruby Hex2Raw :") do
- 1.upto(n) { [sha].pack("H*") }
- end
- x.report("Ribbit Raw2Hex:") do
- 1.upto(n) { Ribbit::Lib.raw_to_hex(raw) }
- end
- x.report("Ruby Raw2Hex :") do
- 1.upto(n) { raw.unpack("H*")[0] }
- end
-end
9 ext/ribbit/extconf.rb
View
@@ -1,9 +0,0 @@
-require 'mkmf'
-
-dir_config("ribbit")
-
-have_library("git2")
-have_library('z')
-
-create_makefile("ribbit")
-
255 ext/ribbit/ribbit.c
View
@@ -1,255 +0,0 @@
-#include "ruby.h"
-#include <git/common.h>
-#include <git/oid.h>
-#include <git/odb.h>
-#include <git/commit.h>
-#include <git/revwalk.h>
-
-static VALUE rb_cRibbit;
-
-/*
- * Ribbit Lib
- */
-
-static VALUE rb_cRibbitLib;
-
-static VALUE rb_git_hex_to_raw(VALUE self, VALUE hex)
-{
- Check_Type(hex, T_STRING);
- git_oid oid;
- git_oid_mkstr(&oid, RSTRING_PTR(hex));
- return rb_str_new((&oid)->id, 20);
-}
-
-static VALUE rb_git_raw_to_hex(VALUE self, VALUE raw)
-{
- Check_Type(raw, T_STRING);
- git_oid oid;
- git_oid_mkraw(&oid, RSTRING_PTR(raw));
- char out[40];
- git_oid_fmt(out, &oid);
- return rb_str_new(out, 40);
-}
-
-/*
- * Ribbit Object Database
- */
-
-static VALUE rb_cRibbitOdb;
-
-static VALUE rb_git_odb_init(VALUE self, VALUE path) {
- rb_iv_set(self, "@path", path);
-
- git_odb *odb;
- git_odb_open(&odb, RSTRING_PTR(path));
-
- rb_iv_set(self, "odb", (VALUE)odb);
-}
-
-static VALUE rb_git_odb_exists(VALUE self, VALUE hex) {
- git_odb *odb;
- odb = (git_odb*)rb_iv_get(self, "odb");
-
- git_oid oid;
- git_oid_mkstr(&oid, RSTRING_PTR(hex));
-
- int exists = git_odb_exists(odb, &oid);
- if(exists == 1) {
- return Qtrue;
- }
- return Qfalse;
-}
-
-/*
-typedef struct {
- void *data; // Raw, decompressed object data.
- size_t len; // Total number of bytes in data.
- git_otype type; // Type of this object.
-} git_obj;
-*/
-
-static VALUE rb_git_odb_read(VALUE self, VALUE hex) {
- git_odb *odb;
- odb = (git_odb*)rb_iv_get(self, "odb");
-
- git_oid oid;
- git_oid_mkstr(&oid, RSTRING_PTR(hex));
-
- git_obj obj;
-
- int read = git_odb_read(&obj, odb, &oid);
- if(read == GIT_SUCCESS) {
- VALUE ret_arr = rb_ary_new();
-
- unsigned char *data = (&obj)->data;
- rb_ary_store(ret_arr, 0, rb_str_new2(data));
-
- rb_ary_store(ret_arr, 1, INT2FIX((int)(&obj)->len));
-
- const char *str_type;
- git_otype git_type = (&obj)->type;
- str_type = git_obj_type_to_string(git_type);
- rb_ary_store(ret_arr, 2, rb_str_new2(str_type));
- return ret_arr;
- }
- return Qfalse;
-}
-
-static VALUE rb_git_odb_obj_hash(VALUE self, VALUE content, VALUE type) {
- git_obj obj;
- git_oid oid;
- (&obj)->data = RSTRING_PTR(content);
- (&obj)->len = RSTRING_LEN(content);
- (&obj)->type = git_obj_string_to_type(RSTRING_PTR(type));
- int result = git_obj_hash(&oid, &obj);
- if(result == GIT_SUCCESS) {
- char out[40];
- git_oid_fmt(out, &oid);
- return rb_str_new(out, 40);
- }
- return Qfalse;
-}
-
-static VALUE rb_git_odb_write(VALUE self, VALUE content, VALUE type) {
- git_odb *odb;
- odb = (git_odb*)rb_iv_get(self, "odb");
-
- git_obj obj;
- git_oid oid;
- (&obj)->data = RSTRING_PTR(content);
- (&obj)->len = RSTRING_LEN(content);
- (&obj)->type = git_obj_string_to_type(RSTRING_PTR(type));
- git_obj_hash(&oid, &obj);
-
- int result = git_odb_write(&oid, odb, &obj);
- if(result == GIT_SUCCESS) {
- char out[40];
- git_oid_fmt(out, &oid);
- return rb_str_new(out, 40);
- }
- return Qfalse;
-}
-
-
-static VALUE rb_git_odb_close(VALUE self) {
- git_odb *odb;
- odb = (git_odb*)rb_iv_get(self, "odb");
- git_odb_close(odb);
-}
-
-/*
- * Ribbit Revwalking
- */
-
-static VALUE rb_cRibbitWalker;
-
-static VALUE rb_git_walker_init(VALUE self, VALUE path) {
- rb_iv_set(self, "@path", path);
-
- git_odb *odb;
- git_odb_open(&odb, RSTRING_PTR(path));
-
- git_revpool *pool;
- pool = gitrp_alloc(odb);
-
- rb_iv_set(self, "pool", (VALUE)pool);
-}
-
-static VALUE rb_git_walker_push(VALUE self, VALUE hex) {
- git_revpool *pool;
- pool = (git_revpool*)rb_iv_get(self, "pool");
-
- git_oid oid;
- git_oid_mkstr(&oid, RSTRING_PTR(hex));
-
- git_commit *commit;
- commit = git_commit_lookup(pool, &oid);
-
- gitrp_push(pool, commit);
- return Qnil;
-}
-
-static VALUE rb_git_walker_next(VALUE self) {
- git_revpool *pool;
- pool = (git_revpool*)rb_iv_get(self, "pool");
-
- git_commit *commit;
- commit = gitrp_next(pool);
- if(commit) {
- const git_oid *oid;
- oid = git_commit_id(commit);
-
- char out[40];
- git_oid_fmt(out, oid);
- return rb_str_new(out, 40);
- }
- return Qfalse;
-}
-
-static VALUE rb_git_walker_hide(VALUE self, VALUE hex) {
- git_revpool *pool;
- pool = (git_revpool*)rb_iv_get(self, "pool");
-
- git_oid oid;
- git_oid_mkstr(&oid, RSTRING_PTR(hex));
-
- git_commit *commit;
- commit = git_commit_lookup(pool, &oid);
-
- gitrp_hide(pool, commit);
- return Qnil;
-}
-
-static VALUE rb_git_walker_sorting(VALUE self, VALUE ruby_sort_mode) {
- git_revpool *pool;
- pool = (git_revpool*)rb_iv_get(self, "pool");
- unsigned int sort_mode = FIX2INT(ruby_sort_mode);
- gitrp_sorting(pool, sort_mode);
- return Qnil;
-}
-
-static VALUE rb_git_walker_reset(VALUE self) {
- git_revpool *pool;
- pool = (git_revpool*)rb_iv_get(self, "pool");
- gitrp_reset(pool);
- return Qnil;
-}
-
-// GIT_EXTERN(void) gitrp_free(git_revpool *pool);
-
-/*
- * Ribbit Init Call
- */
-
-void
-Init_ribbit()
-{
- rb_cRibbit = rb_define_class("Ribbit", rb_cObject);
- rb_cRibbitLib = rb_define_class_under(rb_cRibbit, "Lib", rb_cObject);
-
- rb_define_module_function(rb_cRibbitLib, "hex_to_raw", rb_git_hex_to_raw, 1);
- rb_define_module_function(rb_cRibbitLib, "raw_to_hex", rb_git_raw_to_hex, 1);
-
- rb_cRibbitOdb = rb_define_class_under(rb_cRibbit, "Odb", rb_cObject);
- rb_define_method(rb_cRibbitOdb, "initialize", rb_git_odb_init, 1);
- rb_define_method(rb_cRibbitOdb, "exists", rb_git_odb_exists, 1);
- rb_define_method(rb_cRibbitOdb, "read", rb_git_odb_read, 1);
- rb_define_method(rb_cRibbitOdb, "close", rb_git_odb_close, 0);
- rb_define_method(rb_cRibbitOdb, "hash", rb_git_odb_obj_hash, 2);
- rb_define_method(rb_cRibbitOdb, "write", rb_git_odb_write, 2);
- //rb_define_method(rb_cRibbitOdb, "get_commit", rb_git_commit_lookup, 1);
-
- rb_cRibbitWalker = rb_define_class_under(rb_cRibbit, "Walker", rb_cObject);
- rb_define_method(rb_cRibbitWalker, "initialize", rb_git_walker_init, 1);
- rb_define_method(rb_cRibbitWalker, "push", rb_git_walker_push, 1);
- rb_define_method(rb_cRibbitWalker, "hide", rb_git_walker_hide, 1);
- rb_define_method(rb_cRibbitWalker, "next", rb_git_walker_next, 0);
- rb_define_method(rb_cRibbitWalker, "reset", rb_git_walker_reset, 0);
- rb_define_method(rb_cRibbitWalker, "sorting", rb_git_walker_sorting, 1);
-
- rb_define_const(rb_cRibbit, "SORT_NONE", INT2FIX(0));
- rb_define_const(rb_cRibbit, "SORT_TOPO", INT2FIX(1));
- rb_define_const(rb_cRibbit, "SORT_DATE", INT2FIX(2));
- rb_define_const(rb_cRibbit, "SORT_REVERSE", INT2FIX(4));
-}
-
3  lib/ribbit/version.rb
View
@@ -1,3 +0,0 @@
-class Ribbit
- Version = VERSION = '0.0.1'
-end
20 ribbit.gemspec
View
@@ -1,20 +0,0 @@
-require 'lib/ribbit/version'
-
-Gem::Specification.new do |s|
- s.name = "ribbit"
- s.version = Ribbit::Version
- s.date = Time.now.strftime('%Y-%m-%d')
- s.summary = "Ribbit is a Ruby binding to the libgit2 linkable library"
- s.homepage = "http://github.com/schacon/ribbit"
- s.email = "schacon@gmail.com"
- s.authors = [ "Scott Chacon" ]
- s.files = %w( README API Rakefile LICENSE )
- s.files += Dir.glob("lib/**/*")
- s.files += Dir.glob("man/**/*")
- s.files += Dir.glob("test/**/*")
- s.extensions = ['ext/ribbit/extconf.rb']
- s.description = <<desc
-Ribbit is a Ruby bindings to the libgit2 linkable C Git library. This is
-for testing and using the libgit2 library in a language that is awesome.
-desc
-end
1  test/fixtures/testrepo.git/HEAD
View
@@ -1 +0,0 @@
-ref: refs/heads/master
6 test/fixtures/testrepo.git/config
View
@@ -1,6 +0,0 @@
-[core]
- repositoryformatversion = 0
- filemode = true
- bare = false
- logallrefupdates = true
- ignorecase = true
1  test/fixtures/testrepo.git/description
View
@@ -1 +0,0 @@
-Unnamed repository; edit this file 'description' to name the repository.
BIN  test/fixtures/testrepo.git/index
View
Binary file not shown
6 test/fixtures/testrepo.git/info/exclude
View
@@ -1,6 +0,0 @@
-# git-ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~
2  test/fixtures/testrepo.git/logs/HEAD
View
@@ -1,2 +0,0 @@
-0000000000000000000000000000000000000000 8496071c1b46c854b31185ea97743be6a8774479 Scott Chacon <schacon@gmail.com> 1273360386 -0700 commit (initial): testing
-8496071c1b46c854b31185ea97743be6a8774479 5b5b025afb0b4c913b4c338a42934a3863bf3644 Scott Chacon <schacon@gmail.com> 1273610322 -0700 commit: another commit
2  test/fixtures/testrepo.git/logs/refs/heads/master
View
@@ -1,2 +0,0 @@
-0000000000000000000000000000000000000000 8496071c1b46c854b31185ea97743be6a8774479 Scott Chacon <schacon@gmail.com> 1273360386 -0700 commit (initial): testing
-8496071c1b46c854b31185ea97743be6a8774479 5b5b025afb0b4c913b4c338a42934a3863bf3644 Scott Chacon <schacon@gmail.com> 1273610322 -0700 commit: another commit
BIN  test/fixtures/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08
View
Binary file not shown
BIN  test/fixtures/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7
View
Binary file not shown
BIN  test/fixtures/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd
View
Binary file not shown
BIN  test/fixtures/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057
View
Binary file not shown
2  test/fixtures/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045
View
@@ -1,2 +0,0 @@
-x��Q
-�0D��)��6�ͦ "xO���-�Fb��Eo��0 �Ǥ�,ske�[�Pn8R,EpD?�g�}�^3� ��<��G�hYK���8ЖDA��)���;g�ݧ��j�p�4����-�����r��;�s�GA4ۺ=���(�in7�I�K�FE
2  test/fixtures/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644
View
@@ -1,2 +0,0 @@
-x��� 1E�Ni@��k2 "X�$�YW0Yc���Ås���z����MD��0��8!�����s� X��g�d�::@X0�P�w�"F/����R�Uz�m�ZZ���V}|�/�o5����I�!�1z��:v��Uim}�/�>
-�F-
BIN  test/fixtures/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a
View
Binary file not shown
BIN  test/fixtures/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d
View
Binary file not shown
BIN  test/fixtures/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479
View
Binary file not shown
3  test/fixtures/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a
View
@@ -1,3 +0,0 @@
-x��[
-�0E��*f��դ "�W0��-�F�t�݁��pS[�Y�x�^
-D�b CLhut��}�8X*4Z�sY���U�A�� �X3�R�M��) s6輢M��រ�&Jm��;}����<��\@���ޏpĀ�v�?��jۺL��?H�
2  test/fixtures/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f
View
@@ -1,2 +0,0 @@
-x��;j1D��md���ǎ|M��3`��V{ >���Q����vL0I?�!�4�Z=�!�צ8�F���!r�sQ�y�9�]$D�&�l6A�>jFW�ҵ IKNi��Z�%�S���
-�� �����U~̽��>'��� �w� �[��� ���DGڡ��Q-�M�>d���O����}�\�8g_Ш�oYr
BIN  test/fixtures/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd
View
Binary file not shown
BIN  test/fixtures/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6
View
Binary file not shown
3  test/fixtures/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644
View
@@ -1,3 +0,0 @@
-x��Kj1D��)z�UB��-0�uV9����<#������+�W<J��&8�/s��e���ȕKJ����S
-�Rv��{��Q��r��Y�QN$H\E����=6�X5���K Fr)�(�dC��Ά�����j�s�}��9�c-�w8�o�\�r��I���:
-l}F�W$Ds�ǣ��ٚOW�e�]V8-Ý��"U
3  test/fixtures/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd
View
@@ -1,3 +0,0 @@
-x��Q
-�0D��)�ʦ�I<�'�lR+�Fj��Eo��0<x�h���a ��]ș��XUl�PF)�z�4y�,\r 'S��-mI4
-�Xh�&��F�}n+\���Y�-p|鷜oU�z;-��a��lt{��?�I�,:�o�R��cHK
BIN  test/fixtures/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
View
Binary file not shown
BIN  test/fixtures/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1
View
Binary file not shown
BIN  test/fixtures/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92
View
Binary file not shown
BIN  test/fixtures/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765
View
Binary file not shown
BIN  test/fixtures/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx
View
Binary file not shown
BIN  test/fixtures/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack
View
Binary file not shown
2  test/fixtures/testrepo.git/packed-refs
View
@@ -1,2 +0,0 @@
-# pack-refs with: peeled
-41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9 refs/heads/packed
1  test/fixtures/testrepo.git/refs/heads/master
View
@@ -1 +0,0 @@
-5b5b025afb0b4c913b4c338a42934a3863bf3644
33 test/lib_test.rb
View
@@ -1,33 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-require 'base64'
-
-context "Ribbit::Lib stuff" do
- setup do
- end
-
- test "can convert hex into raw sha" do
- raw = Ribbit::Lib.hex_to_raw("ce08fe4884650f067bd5703b6a59a8b3b3c99a09")
- b64raw = Base64.encode64(raw).strip
- assert_equal "zgj+SIRlDwZ71XA7almos7PJmgk=", b64raw
- end
-
- test "converts hex into raw sha correctly" do
- hex = "ce08fe4884650f067bd5703b6a59a8b3b3c99a09"
- raw1 = Ribbit::Lib.hex_to_raw(hex)
- raw2 = [hex].pack("H*")
- assert_equal raw1, raw2
- end
-
- test "can convert raw sha into hex" do
- raw = Base64.decode64("FqASNFZ4mrze9Ld1ITwjqL109eA=")
- hex = Ribbit::Lib.raw_to_hex(raw)
- assert_equal "16a0123456789abcdef4b775213c23a8bd74f5e0", hex
- end
-
- test "converts raw into hex sha correctly" do
- raw = Ribbit::Lib.hex_to_raw("ce08fe4884650f067bd5703b6a59a8b3b3c99a09")
- hex1 = Ribbit::Lib.raw_to_hex(raw)
- hex2 = raw.unpack("H*")[0]
- assert_equal hex1, hex2
- end
-end
22 test/odb_pack_test.rb
View
@@ -1,22 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-require 'base64'
-
-context "Ribbit::Odb packed stuff" do
- setup do
- path = File.dirname(__FILE__) + '/fixtures/testrepo.git/objects'
- @odb = Ribbit::Odb.new(path)
- end
-
- test "can tell if a packed object exists" do
- assert @odb.exists("41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9")
- assert @odb.exists("f82a8eb4cb20e88d1030fd10d89286215a715396")
- end
-
- #test "can read a packed object from the db" do
- # data, len, type = @odb.read("41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9")
- # assert_match 'tree f82a8eb4cb20e88d1030fd10d89286215a715396', data
- # assert_equal 230, len
- # assert_equal "commit", type
- #end
-
-end
56 test/odb_test.rb
View
@@ -1,56 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-require 'base64'
-
-context "Ribbit::Odb stuff" do
- setup do
- @path = File.dirname(__FILE__) + '/fixtures/testrepo.git/objects'
- @odb = Ribbit::Odb.new(@path)
- end
-
- def rm_loose(sha)
- dir = sha[0, 2]
- rest = sha[2, 38]
- file = File.join(@path, dir, rest)
- `rm -f #{file}`
- end
-
- test "can tell if an object exists or not" do
- assert @odb.exists("8496071c1b46c854b31185ea97743be6a8774479")
- assert @odb.exists("1385f264afb75a56a5bec74243be9b367ba4ca08")
- assert !@odb.exists("ce08fe4884650f067bd5703b6a59a8b3b3c99a09")
- assert !@odb.exists("8496071c1c46c854b31185ea97743be6a8774479")
- end
-
- test "can read an object from the db" do
- data, len, type = @odb.read("8496071c1b46c854b31185ea97743be6a8774479")
- assert_match 'tree 181037049a54a1eb5fab404658a3a250b44335d7', data
- assert_equal 172, len
- assert_equal "commit", type
- end
-
- test "returns false if an object is not there" do
- assert !@odb.read("a496071c1b46c854b31185ea97743be6a8774471")
- end
-
- test "can close the db" do
- @odb.exists("8496071c1b46c854b31185ea97743be6a8774479")
- @odb.close
- assert !@odb.exists("8496071c1b46c854b31185ea97743be6a8774479")
- end
-
- test "can hash data" do
- content = "my test data\n"
- sha = @odb.hash(content, "blob")
- assert_equal "76b1b55ab653581d6f2c7230d34098e837197674", sha
- assert !@odb.exists("76b1b55ab653581d6f2c7230d34098e837197674")
- end
-
- test "can write to the db" do
- content = "my test data\n"
- sha = @odb.write(content, "blob")
- assert_equal "76b1b55ab653581d6f2c7230d34098e837197674", sha
- assert @odb.exists("76b1b55ab653581d6f2c7230d34098e837197674")
- rm_loose("76b1b55ab653581d6f2c7230d34098e837197674")
- end
-
-end
27 test/test_helper.rb
View
@@ -1,27 +0,0 @@
-dir = File.dirname(File.expand_path(__FILE__))
-$LOAD_PATH.unshift dir + '/../lib'
-$TESTING = true
-require 'test/unit'
-require 'rubygems'
-require 'ribbit'
-require 'pp'
-
-##
-# test/spec/mini 3
-# http://gist.github.com/25455
-# chris@ozmm.org
-#
-def context(*args, &block)
- return super unless (name = args.first) && block
- require 'test/unit'
- klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do
- def self.test(name, &block)
- define_method("test_#{name.gsub(/\W/,'_')}", &block) if block
- end
- def self.xtest(*args) end
- def self.setup(&block) define_method(:setup, &block) end
- def self.teardown(&block) define_method(:teardown, &block) end
- end
- (class << klass; self end).send(:define_method, :name) { name.gsub(/\W/,'_') }
- klass.class_eval &block
-end
75 test/walker_test.rb
View
@@ -1,75 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-require 'base64'
-
-context "Ribbit::Walker stuff" do
- setup do
- @path = File.dirname(__FILE__) + '/fixtures/testrepo.git/objects'
- @walker = Ribbit::Walker.new(@path)
- end
-
- test "can walk a simple revlist" do
- @walker.push("9fd738e8f7967c078dceed8190330fc8648ee56a")
- data = []
- 4.times do
- data << @walker.next
- end
- shas = data.sort.map {|a| a[0,5] }.join('.')
- assert_equal "4a202.5b5b0.84960.9fd73", shas
- assert_equal false, @walker.next
- end
-
- test "can walk a part of a revlist" do
- sha = "8496071c1b46c854b31185ea97743be6a8774479"
- @walker.push(sha)
- assert_equal sha, @walker.next
- assert_equal false, @walker.next
- end
-
- test "can hide part of a list" do
- @walker.push("9fd738e8f7967c078dceed8190330fc8648ee56a")
- @walker.hide("5b5b025afb0b4c913b4c338a42934a3863bf3644")
- 2.times { @walker.next }
- assert_equal false, @walker.next
- end
-
- test "can reset a walker" do
- sha = "8496071c1b46c854b31185ea97743be6a8774479"
- @walker.push(sha)
- assert_equal sha, @walker.next
- assert_equal false, @walker.next
- @walker.reset
- assert_equal sha, @walker.next
- end
-
- def revlist_with_sorting(sorting)
- sha = "a4a7dce85cf63874e984719f4fdd239f5145052f"
- @walker.sorting(sorting)
- @walker.push(sha)
- data = []
- 6.times do
- data << @walker.next
- end
- shas = data.map {|a| a[0,5] if a }.join('.')
- end
-
- test "can sort order by date" do
- time = revlist_with_sorting(Ribbit::SORT_DATE)
- assert_equal "a4a7d.c4780.9fd73.4a202.5b5b0.84960", time
- end
-
- test "can sort order by topo" do
- topo = revlist_with_sorting(Ribbit::SORT_TOPO)
- assert_equal "a4a7d.9fd73.4a202.c4780.5b5b0.84960", topo
- end
-
- test "can sort order by date reversed" do
- time = revlist_with_sorting(Ribbit::SORT_DATE | Ribbit::SORT_REVERSE)
- assert_equal "84960.5b5b0.4a202.9fd73.c4780.a4a7d", time
- end
-
- test "can sort order by topo reversed" do
- topo_rev = revlist_with_sorting(Ribbit::SORT_TOPO | Ribbit::SORT_REVERSE)
- assert_equal "84960.5b5b0.c4780.4a202.9fd73.a4a7d", topo_rev
- end
-
-end
Please sign in to comment.
Something went wrong with that request. Please try again.