mojombo-grit 0.9.4 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/API.txt +101 -0
  2. data/History.txt +38 -2
  3. data/README.md +210 -0
  4. data/VERSION.yml +4 -0
  5. data/lib/grit.rb +13 -4
  6. data/lib/grit/blame.rb +61 -0
  7. data/lib/grit/blob.rb +11 -2
  8. data/lib/grit/commit.rb +44 -31
  9. data/lib/grit/commit_stats.rb +26 -2
  10. data/lib/grit/diff.rb +6 -6
  11. data/lib/grit/git-ruby.rb +4 -2
  12. data/lib/grit/git-ruby/file_index.rb +10 -3
  13. data/lib/grit/git-ruby/git_object.rb +9 -3
  14. data/lib/grit/git-ruby/internal/{mmap.rb → file_window.rb} +2 -2
  15. data/lib/grit/git-ruby/internal/loose.rb +6 -6
  16. data/lib/grit/git-ruby/internal/pack.rb +19 -19
  17. data/lib/grit/git-ruby/object.rb +8 -2
  18. data/lib/grit/git-ruby/repository.rb +11 -6
  19. data/lib/grit/git.rb +23 -10
  20. data/lib/grit/index.rb +12 -11
  21. data/lib/grit/merge.rb +45 -0
  22. data/lib/grit/ref.rb +20 -16
  23. data/lib/grit/repo.rb +59 -9
  24. data/lib/grit/ruby1.9.rb +7 -0
  25. data/lib/grit/submodule.rb +5 -1
  26. data/lib/grit/tag.rb +61 -66
  27. data/lib/grit/tree.rb +20 -1
  28. metadata +29 -47
  29. data/Manifest.txt +0 -71
  30. data/README.txt +0 -213
  31. data/Rakefile +0 -29
  32. data/grit.gemspec +0 -62
  33. data/lib/grit/head.rb +0 -83
  34. data/test/test_actor.rb +0 -35
  35. data/test/test_blob.rb +0 -79
  36. data/test/test_commit.rb +0 -190
  37. data/test/test_config.rb +0 -58
  38. data/test/test_diff.rb +0 -18
  39. data/test/test_git.rb +0 -64
  40. data/test/test_grit.rb +0 -32
  41. data/test/test_head.rb +0 -47
  42. data/test/test_real.rb +0 -19
  43. data/test/test_reality.rb +0 -17
  44. data/test/test_remote.rb +0 -14
  45. data/test/test_repo.rb +0 -277
  46. data/test/test_tag.rb +0 -25
  47. data/test/test_tree.rb +0 -96
@@ -1,25 +0,0 @@
1
- require File.dirname(__FILE__) + '/helper'
2
-
3
- class TestTag < Test::Unit::TestCase
4
- def setup
5
- @r = Repo.new(GRIT_REPO)
6
- end
7
-
8
- # list_from_string
9
-
10
- def test_list_from_string
11
- tags = @r.tags
12
-
13
- assert_equal 1, tags.size
14
- assert_equal 'v0.7.0', tags.first.name
15
- assert_equal 'f0055fda16c18fd8b27986dbf038c735b82198d7', tags.first.commit.id
16
- end
17
-
18
- # inspect
19
-
20
- def test_inspect
21
- tag = @r.tags.first
22
-
23
- assert_equal %Q{#<Grit::Tag "#{tag.name}">}, tag.inspect
24
- end
25
- end
@@ -1,96 +0,0 @@
1
- require File.dirname(__FILE__) + '/helper'
2
-
3
- class TestTree < Test::Unit::TestCase
4
- def setup
5
- @r = Repo.new(GRIT_REPO)
6
- @t = Tree.allocate
7
- end
8
-
9
- # contents
10
- def test_nosuch_tree
11
- t = @r.tree('blahblah')
12
- assert t.contents.is_a?(Array)
13
- assert t.is_a?(Tree)
14
- end
15
-
16
- def test_contents_should_cache
17
- Git.any_instance.expects(:ls_tree).returns(
18
- fixture('ls_tree_a'),
19
- fixture('ls_tree_b')
20
- ).times(2)
21
- tree = @r.tree('master')
22
-
23
- child = tree.contents.last
24
-
25
- child.contents
26
- child.contents
27
- end
28
-
29
- # content_from_string
30
-
31
- def test_content_from_string_tree_should_return_tree
32
- text = fixture('ls_tree_a').split("\n").last
33
-
34
- tree = @t.content_from_string(nil, text)
35
-
36
- assert_equal Tree, tree.class
37
- assert_equal "650fa3f0c17f1edb4ae53d8dcca4ac59d86e6c44", tree.id
38
- assert_equal "040000", tree.mode
39
- assert_equal "test", tree.name
40
- end
41
-
42
- def test_content_from_string_tree_should_return_blob
43
- text = fixture('ls_tree_b').split("\n").first
44
-
45
- tree = @t.content_from_string(nil, text)
46
-
47
- assert_equal Blob, tree.class
48
- assert_equal "aa94e396335d2957ca92606f909e53e7beaf3fbb", tree.id
49
- assert_equal "100644", tree.mode
50
- assert_equal "grit.rb", tree.name
51
- end
52
-
53
- def test_content_from_string_tree_should_return_submodule
54
- text = fixture('ls_tree_submodule').split("\n").first
55
-
56
- sm = @t.content_from_string(nil, text)
57
-
58
- assert_kind_of Submodule, sm
59
- end
60
-
61
- def test_content_from_string_invalid_type_should_raise
62
- assert_raise(RuntimeError) do
63
- @t.content_from_string(nil, "040000 bogus 650fa3f0c17f1edb4ae53d8dcca4ac59d86e6c44 test")
64
- end
65
- end
66
-
67
- # /
68
-
69
- def test_slash
70
- Git.any_instance.expects(:ls_tree).returns(
71
- fixture('ls_tree_a')
72
- )
73
- tree = @r.tree('master')
74
-
75
- assert_equal 'aa06ba24b4e3f463b3c4a85469d0fb9e5b421cf8', (tree/'lib').id
76
- assert_equal '8b1e02c0fb554eed2ce2ef737a68bb369d7527df', (tree/'README.txt').id
77
- end
78
-
79
- def test_slash_with_commits
80
- Git.any_instance.expects(:ls_tree).returns(
81
- fixture('ls_tree_commit')
82
- )
83
- tree = @r.tree('master')
84
-
85
- assert_equal 'd35b34c6e931b9da8f6941007a92c9c9a9b0141a', (tree/'bar').id
86
- assert_equal '2afb47bcedf21663580d5e6d2f406f08f3f65f19', (tree/'foo').id
87
- assert_equal 'f623ee576a09ca491c4a27e48c0dfe04be5f4a2e', (tree/'baz').id
88
- end
89
-
90
- # inspect
91
-
92
- def test_inspect
93
- @t = Tree.create(@r, :id => 'abc')
94
- assert_equal %Q{#<Grit::Tree "abc">}, @t.inspect
95
- end
96
- end