grit 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grit might be problematic. Click here for more details.

@@ -93,4 +93,9 @@ class TestTree < Test::Unit::TestCase
93
93
  @t = Tree.create(@r, :id => 'abc')
94
94
  assert_equal %Q{#<Grit::Tree "abc">}, @t.inspect
95
95
  end
96
+
97
+ def test_basename
98
+ @t = Tree.create(@r, :name => 'foo/bar')
99
+ assert_equal "bar", @t.basename
100
+ end
96
101
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-02-10 00:00:00 -08:00
13
+ date: 2009-03-29 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -44,7 +44,7 @@ extra_rdoc_files: []
44
44
  files:
45
45
  - API.txt
46
46
  - History.txt
47
- - README.txt
47
+ - README.md
48
48
  - VERSION.yml
49
49
  - lib/grit
50
50
  - lib/grit/actor.rb
@@ -60,8 +60,8 @@ files:
60
60
  - lib/grit/git-ruby/file_index.rb
61
61
  - lib/grit/git-ruby/git_object.rb
62
62
  - lib/grit/git-ruby/internal
63
+ - lib/grit/git-ruby/internal/file_window.rb
63
64
  - lib/grit/git-ruby/internal/loose.rb
64
- - lib/grit/git-ruby/internal/mmap.rb
65
65
  - lib/grit/git-ruby/internal/pack.rb
66
66
  - lib/grit/git-ruby/internal/raw_object.rb
67
67
  - lib/grit/git-ruby/object.rb
@@ -73,6 +73,7 @@ files:
73
73
  - lib/grit/merge.rb
74
74
  - lib/grit/ref.rb
75
75
  - lib/grit/repo.rb
76
+ - lib/grit/ruby1.9.rb
76
77
  - lib/grit/status.rb
77
78
  - lib/grit/submodule.rb
78
79
  - lib/grit/tag.rb
@@ -1130,6 +1131,7 @@ files:
1130
1131
  - test/dot_git/objects/b7/2772427161ca37e13344c1a9573dfdde28a881
1131
1132
  - test/dot_git/objects/b7/6a1914a9461f6e66a4fc5a32b890f38b3dbe89
1132
1133
  - test/dot_git/objects/b7/90eae3127d5f3c9d501885ae9e17f342b25298
1134
+ - test/dot_git/objects/b7/f932bd02b3e0a4228ee7b55832749028d345de
1133
1135
  - test/dot_git/objects/b8
1134
1136
  - test/dot_git/objects/b8/2e9938dbcadfcb79efff23a12763d6ec48f19d
1135
1137
  - test/dot_git/objects/b8/46d2f4cb2a5adfb0c4f46e73f53a074e76c2f6
@@ -1557,6 +1559,8 @@ files:
1557
1559
  - test/dot_git/refs/remotes/tom
1558
1560
  - test/dot_git/refs/remotes/tom/master
1559
1561
  - test/dot_git/refs/tags
1562
+ - test/dot_git/refs/tags/annotated
1563
+ - test/dot_git/refs/tags/not_annotated
1560
1564
  - test/dot_git/refs/tags/v0.7.0
1561
1565
  - test/dot_git_clone
1562
1566
  - test/dot_git_clone/config
@@ -1673,6 +1677,8 @@ files:
1673
1677
  - test/fixtures/rev_list
1674
1678
  - test/fixtures/rev_list_all
1675
1679
  - test/fixtures/rev_list_count
1680
+ - test/fixtures/rev_list_delta_a
1681
+ - test/fixtures/rev_list_delta_b
1676
1682
  - test/fixtures/rev_list_lines
1677
1683
  - test/fixtures/rev_list_range
1678
1684
  - test/fixtures/rev_list_since
@@ -1681,6 +1687,7 @@ files:
1681
1687
  - test/fixtures/ruby_diff
1682
1688
  - test/fixtures/ruby_diff_full_index
1683
1689
  - test/fixtures/ruby_for_each_ref
1690
+ - test/fixtures/show_cc
1684
1691
  - test/fixtures/show_empty_commit
1685
1692
  - test/fixtures/simple_config
1686
1693
  - test/helper.rb
data/README.txt DELETED
@@ -1,222 +0,0 @@
1
- grit
2
- by Tom Preston-Werner, Scott Chacon
3
- http://github.com/mojombo/grit
4
-
5
- == DESCRIPTION:
6
-
7
- Grit is a Ruby library for extracting information from a git repository in an
8
- object oriented manner.
9
-
10
- == REQUIREMENTS:
11
-
12
- * git (http://git-scm.com) tested with 1.6.0.2
13
-
14
- == INSTALL:
15
-
16
- Easiest install is via RubyGems:
17
-
18
- $ gem install grit
19
-
20
- or
21
-
22
- $ gem sources -a http://gems.github.com/ (you only need to do this once)
23
- $ gem install mojombo-grit
24
-
25
- The gem from GitHub will generally be available sooner than the gem from
26
- Rubyforge. Both sources will eventually contain the same releases.
27
-
28
- == SOURCE:
29
-
30
- Grit's git repo is available on GitHub, which can be browsed at:
31
-
32
- http://github.com/mojombo/grit
33
-
34
- and cloned from:
35
-
36
- git://github.com/mojombo/grit.git
37
-
38
- == USAGE:
39
-
40
- Grit gives you object model access to your git repository. Once you have
41
- created a repository object, you can traverse it to find parent commit(s),
42
- trees, blobs, etc.
43
-
44
- = Initialize a Repo object
45
-
46
- The first step is to create a Grit::Repo object to represent your repo. I
47
- include the Grit module so reduce typing.
48
-
49
- require 'grit'
50
- include Grit
51
- repo = Repo.new("/Users/tom/dev/grit")
52
-
53
- In the above example, the directory /Users/tom/dev/grit is my working
54
- repo and contains the .git directory. You can also initialize Grit with a
55
- bare repo.
56
-
57
- repo = Repo.new("/var/git/grit.git")
58
-
59
- = Getting a list of commits
60
-
61
- From the Repo object, you can get a list of commits as an array of Commit
62
- objects.
63
-
64
- repo.commits
65
- # => [#<Grit::Commit "e80bbd2ce67651aa18e57fb0b43618ad4baf7750">,
66
- #<Grit::Commit "91169e1f5fa4de2eaea3f176461f5dc784796769">,
67
- #<Grit::Commit "038af8c329ef7c1bae4568b98bd5c58510465493">,
68
- #<Grit::Commit "40d3057d09a7a4d61059bca9dca5ae698de58cbe">,
69
- #<Grit::Commit "4ea50f4754937bf19461af58ce3b3d24c77311d9">]
70
-
71
- Called without arguments, Repo#commits returns a list of up to ten commits
72
- reachable by the master branch (starting at the latest commit). You can ask
73
- for commits beginning at a different branch, commit, tag, etc.
74
-
75
- repo.commits('mybranch')
76
- repo.commits('40d3057d09a7a4d61059bca9dca5ae698de58cbe')
77
- repo.commits('v0.1')
78
-
79
- You can specify the maximum number of commits to return.
80
-
81
- repo.commits('master', 100)
82
-
83
- If you need paging, you can specify a number of commits to skip.
84
-
85
- repo.commits('master', 10, 20)
86
-
87
- The above will return commits 21-30 from the commit list.
88
-
89
- = The Commit object
90
-
91
- Commit objects contain information about that commit.
92
-
93
- head = repo.commits.first
94
-
95
- head.id
96
- # => "e80bbd2ce67651aa18e57fb0b43618ad4baf7750"
97
-
98
- head.parents
99
- # => [#<Grit::Commit "91169e1f5fa4de2eaea3f176461f5dc784796769">]
100
-
101
- head.tree
102
- # => #<Grit::Tree "3536eb9abac69c3e4db583ad38f3d30f8db4771f">
103
-
104
- head.author
105
- # => #<Grit::Actor "Tom Preston-Werner <tom@mojombo.com>">
106
-
107
- head.authored_date
108
- # => Wed Oct 24 22:02:31 -0700 2007
109
-
110
- head.committer
111
- # => #<Grit::Actor "Tom Preston-Werner <tom@mojombo.com>">
112
-
113
- head.committed_date
114
- # => Wed Oct 24 22:02:31 -0700 2007
115
-
116
- head.message
117
- # => "add Actor inspect"
118
-
119
- You can traverse a commit's ancestry by chaining calls to #parents.
120
-
121
- repo.commits.first.parents[0].parents[0].parents[0]
122
-
123
- The above corresponds to master^^^ or master~3 in git parlance.
124
-
125
- = The Tree object
126
-
127
- A tree records pointers to the contents of a directory. Let's say you want
128
- the root tree of the latest commit on the master branch.
129
-
130
- tree = repo.commits.first.tree
131
- # => #<Grit::Tree "3536eb9abac69c3e4db583ad38f3d30f8db4771f">
132
-
133
- tree.id
134
- # => "3536eb9abac69c3e4db583ad38f3d30f8db4771f"
135
-
136
- Once you have a tree, you can get the contents.
137
-
138
- contents = tree.contents
139
- # => [#<Grit::Blob "4ebc8aea50e0a67e000ba29a30809d0a7b9b2666">,
140
- #<Grit::Blob "81d2c27608b352814cbe979a6acd678d30219678">,
141
- #<Grit::Tree "c3d07b0083f01a6e1ac969a0f32b8d06f20c62e5">,
142
- #<Grit::Tree "4d00fe177a8407dbbc64a24dbfc564762c0922d8">]
143
-
144
- This tree contains two Blob objects and two Tree objects. The trees are
145
- subdirectories and the blobs are files. Trees below the root have additional
146
- attributes.
147
-
148
- contents.last.name
149
- # => "lib"
150
-
151
- contents.last.mode
152
- # => "040000"
153
-
154
- There is a convenience method that allows you to get a named sub-object
155
- from a tree.
156
-
157
- tree/"lib"
158
- # => #<Grit::Tree "e74893a3d8a25cbb1367cf241cc741bfd503c4b2">
159
-
160
- You can also get a tree directly from the repo if you know its name.
161
-
162
- repo.tree
163
- # => #<Grit::Tree "master">
164
-
165
- repo.tree("91169e1f5fa4de2eaea3f176461f5dc784796769")
166
- # => #<Grit::Tree "91169e1f5fa4de2eaea3f176461f5dc784796769">
167
-
168
- = The Blob object
169
-
170
- A blob represents a file. Trees often contain blobs.
171
-
172
- blob = tree.contents.first
173
- # => #<Grit::Blob "4ebc8aea50e0a67e000ba29a30809d0a7b9b2666">
174
-
175
- A blob has certain attributes.
176
-
177
- blob.id
178
- # => "4ebc8aea50e0a67e000ba29a30809d0a7b9b2666"
179
-
180
- blob.name
181
- # => "README.txt"
182
-
183
- blob.mode
184
- # => "100644"
185
-
186
- blob.size
187
- # => 7726
188
-
189
- You can get the data of a blob as a string.
190
-
191
- blob.data
192
- # => "Grit is a library to ..."
193
-
194
- You can also get a blob directly from the repo if you know its name.
195
-
196
- repo.blob("4ebc8aea50e0a67e000ba29a30809d0a7b9b2666")
197
- # => #<Grit::Blob "4ebc8aea50e0a67e000ba29a30809d0a7b9b2666">
198
-
199
- == LICENSE:
200
-
201
- (The MIT License)
202
-
203
- Copyright (c) 2007 Tom Preston-Werner
204
-
205
- Permission is hereby granted, free of charge, to any person obtaining
206
- a copy of this software and associated documentation files (the
207
- 'Software'), to deal in the Software without restriction, including
208
- without limitation the rights to use, copy, modify, merge, publish,
209
- distribute, sublicense, and/or sell copies of the Software, and to
210
- permit persons to whom the Software is furnished to do so, subject to
211
- the following conditions:
212
-
213
- The above copyright notice and this permission notice shall be
214
- included in all copies or substantial portions of the Software.
215
-
216
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
217
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
218
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
219
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
220
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
221
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
222
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.