grit 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,32 @@ module Grit
18
18
  end
19
19
  end
20
20
 
21
+ # Writes a new tag object from a hash
22
+ # +repo+ is a Grit repo
23
+ # +hash+ is the hash of tag values
24
+ #
25
+ # Returns a hash with +sha+ and +size+ of the created object
26
+ def self.create_tag_object(repo, hash, default_actor = nil)
27
+ tagger = hash[:tagger]
28
+ if !tagger
29
+ tagger = default_actor ? default_actor : Actor.new("none", "none@none")
30
+ tagger_date = Time.now
31
+ else
32
+ tagger_date = tagger[:date] ? Time.parse(tagger[:date]) : Time.now
33
+ tagger = Actor.new(tagger[:name], tagger[:email])
34
+ end
35
+ data = []
36
+ data << "object #{hash[:object]}"
37
+ data << "type #{hash[:type]}"
38
+ data << "tag #{hash[:tag]}"
39
+ data << "tagger #{tagger.output(tagger_date)}"
40
+ data << ""
41
+ data << hash[:message]
42
+ data = data.join("\n")
43
+ sha = repo.git.put_raw_object(data, 'tag')
44
+ { :sha => sha, :size => data.size }
45
+ end
46
+
21
47
  # Parses the results from `cat-file -p`
22
48
  #
23
49
  # data - String tag object data. Example:
@@ -34,9 +60,9 @@ module Grit
34
60
  return unless data =~ /^object/
35
61
  parsed = {}
36
62
  lines = data.split("\n")
37
- lines.shift # type commit
38
- lines.shift # tag name
39
- lines.shift
63
+ parsed[:object] = lines.shift.sub(/^object /, '')
64
+ parsed[:type] = lines.shift.sub(/^type /, '')
65
+ parsed[:tag] = lines.shift.sub(/^tag /, '')
40
66
  author_line = lines.shift
41
67
  parsed[:tagger], parsed[:tag_date] = Commit.actor(author_line)
42
68
  if !parsed[:tagger] || !parsed[:tagger].name
@@ -49,6 +75,11 @@ module Grit
49
75
  parsed[:message] << lines.shift
50
76
  end
51
77
  parsed[:message] = parsed[:message] * "\n"
78
+ parsed[:pgp] = []
79
+ while lines.first
80
+ parsed[:pgp] << lines.shift
81
+ end
82
+ parsed[:pgp] = parsed[:pgp] * "\n"
52
83
  parsed
53
84
  end
54
85
 
@@ -15,7 +15,7 @@ module Grit
15
15
  #
16
16
  # Returns Grit::Tree (baked)
17
17
  def self.construct(repo, treeish, paths = [])
18
- output = repo.git.ls_tree({}, treeish, *paths)
18
+ output = repo.git.ls_tree({:raise => true}, treeish, *paths)
19
19
  self.allocate.construct_initialize(repo, treeish, output)
20
20
  end
21
21
 
@@ -65,7 +65,7 @@ module Grit
65
65
  #
66
66
  # Returns Grit::Blob or Grit::Tree
67
67
  def content_from_string(repo, text)
68
- mode, type, id, name = text.split(" ", 4)
68
+ mode, type, id, name = text.split(/ |\t/, 4)
69
69
  case type
70
70
  when "tree"
71
71
  Tree.create(repo, :id => id, :mode => mode, :name => name)
metadata CHANGED
@@ -1,78 +1,70 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: grit
3
- version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
6
- segments:
7
- - 2
8
- - 4
9
- - 1
10
- version: 2.4.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.5.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Tom Preston-Werner
14
9
  - Scott Chacon
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2011-01-13 00:00:00 -08:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
23
- name: mime-types
13
+ date: 2012-04-22 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: posix-spawn
17
+ requirement: &70299123428600 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 0.3.6
23
+ type: :runtime
24
24
  prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
25
+ version_requirements: *70299123428600
26
+ - !ruby/object:Gem::Dependency
27
+ name: mime-types
28
+ requirement: &70299123427640 !ruby/object:Gem::Requirement
26
29
  none: false
27
- requirements:
30
+ requirements:
28
31
  - - ~>
29
- - !ruby/object:Gem::Version
30
- hash: 17
31
- segments:
32
- - 1
33
- - 15
34
- version: "1.15"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.15'
35
34
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: diff-lcs
39
35
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
36
+ version_requirements: *70299123427640
37
+ - !ruby/object:Gem::Dependency
38
+ name: diff-lcs
39
+ requirement: &70299123426680 !ruby/object:Gem::Requirement
41
40
  none: false
42
- requirements:
41
+ requirements:
43
42
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 13
46
- segments:
47
- - 1
48
- - 1
49
- version: "1.1"
43
+ - !ruby/object:Gem::Version
44
+ version: '1.1'
50
45
  type: :runtime
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: mocha
54
46
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
47
+ version_requirements: *70299123426680
48
+ - !ruby/object:Gem::Dependency
49
+ name: mocha
50
+ requirement: &70299123425520 !ruby/object:Gem::Requirement
56
51
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
- version: "0"
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
64
56
  type: :development
65
- version_requirements: *id003
66
- description: Grit is a Ruby library for extracting information from a git repository in an object oriented manner.
57
+ prerelease: false
58
+ version_requirements: *70299123425520
59
+ description: Grit is a Ruby library for extracting information from a git repository
60
+ in an object oriented manner.
67
61
  email: tom@github.com
68
62
  executables: []
69
-
70
63
  extensions: []
71
-
72
- extra_rdoc_files:
64
+ extra_rdoc_files:
73
65
  - README.md
74
66
  - LICENSE
75
- files:
67
+ files:
76
68
  - API.txt
77
69
  - History.txt
78
70
  - LICENSE
@@ -95,20 +87,16 @@ files:
95
87
  - lib/grit/errors.rb
96
88
  - lib/grit/git-ruby.rb
97
89
  - lib/grit/git-ruby/commit_db.rb
98
- - lib/grit/git-ruby/file_index.rb
99
90
  - lib/grit/git-ruby/git_object.rb
100
91
  - lib/grit/git-ruby/internal/file_window.rb
101
92
  - lib/grit/git-ruby/internal/loose.rb
102
93
  - lib/grit/git-ruby/internal/pack.rb
103
94
  - lib/grit/git-ruby/internal/raw_object.rb
104
- - lib/grit/git-ruby/object.rb
105
95
  - lib/grit/git-ruby/repository.rb
106
96
  - lib/grit/git.rb
107
97
  - lib/grit/index.rb
108
- - lib/grit/jruby.rb
109
98
  - lib/grit/lazy.rb
110
99
  - lib/grit/merge.rb
111
- - lib/grit/process.rb
112
100
  - lib/grit/ref.rb
113
101
  - lib/grit/repo.rb
114
102
  - lib/grit/ruby1.9.rb
@@ -116,39 +104,29 @@ files:
116
104
  - lib/grit/submodule.rb
117
105
  - lib/grit/tag.rb
118
106
  - lib/grit/tree.rb
119
- has_rdoc: true
120
107
  homepage: http://github.com/mojombo/grit
121
108
  licenses: []
122
-
123
109
  post_install_message:
124
- rdoc_options:
110
+ rdoc_options:
125
111
  - --charset=UTF-8
126
- require_paths:
112
+ require_paths:
127
113
  - lib
128
- required_ruby_version: !ruby/object:Gem::Requirement
114
+ required_ruby_version: !ruby/object:Gem::Requirement
129
115
  none: false
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- hash: 3
134
- segments:
135
- - 0
136
- version: "0"
137
- required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
121
  none: false
139
- requirements:
140
- - - ">="
141
- - !ruby/object:Gem::Version
142
- hash: 3
143
- segments:
144
- - 0
145
- version: "0"
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
146
126
  requirements: []
147
-
148
127
  rubyforge_project: grit
149
- rubygems_version: 1.3.7
128
+ rubygems_version: 1.8.11
150
129
  signing_key:
151
130
  specification_version: 2
152
131
  summary: Ruby Git bindings.
153
132
  test_files: []
154
-
@@ -1,193 +0,0 @@
1
- # this implements a file-based 'file index', an simple index of
2
- # all of the reachable commits in a repo, along with the parents
3
- # and which files were modified during each commit
4
- #
5
- # this class looks for a file named '[.git]/file-index', generated via:
6
- #
7
- # git log --pretty=oneline --name-only --parents --reverse --all > file-index
8
- #
9
- # for this to work properly, you'll want to add the following as a post-receive hook
10
- # to keep the index up to date
11
- #
12
- # git log --pretty=oneline --name-only --parents --reverse [old-rev]..[new-rev] >> file-index
13
- #
14
- module Grit
15
- module GitRuby
16
-
17
- class FileIndex
18
-
19
- class IndexFileNotFound < StandardError
20
- end
21
-
22
- class UnsupportedRef < StandardError
23
- end
24
-
25
- class << self
26
- attr_accessor :max_file_size
27
- end
28
-
29
- self.max_file_size = 10_000_000 # ~10M
30
-
31
- attr_reader :files
32
-
33
- # initializes index given repo_path
34
- def initialize(repo_path)
35
- @index_file = File.join(repo_path, 'file-index')
36
- if File.file?(@index_file) && (File.size(@index_file) < Grit::GitRuby::FileIndex.max_file_size)
37
- read_index
38
- else
39
- raise IndexFileNotFound
40
- end
41
- end
42
-
43
- # returns count of all commits
44
- def count_all
45
- @sha_count
46
- end
47
-
48
- # returns count of all commits reachable from SHA
49
- # note: originally did this recursively, but ruby gets pissed about that on
50
- # really big repos where the stack level gets 'too deep' (thats what she said)
51
- def count(commit_sha)
52
- commits_from(commit_sha).size
53
- end
54
-
55
- # builds a list of all commits reachable from a single commit
56
- def commits_from(commit_sha)
57
- raise UnsupportedRef if commit_sha.is_a? Array
58
-
59
- already = {}
60
- final = []
61
- left_to_do = [commit_sha]
62
-
63
- while commit_sha = left_to_do.shift
64
- next if already[commit_sha]
65
-
66
- final << commit_sha
67
- already[commit_sha] = true
68
-
69
- commit = @commit_index[commit_sha]
70
- commit[:parents].each do |sha|
71
- left_to_do << sha
72
- end if commit
73
- end
74
-
75
- sort_commits(final)
76
- end
77
-
78
- def sort_commits(sha_array)
79
- sha_array.sort { |a, b| @commit_order[b].to_i <=> @commit_order[a].to_i }
80
- end
81
-
82
- # returns files changed at commit sha
83
- def files(commit_sha)
84
- @commit_index[commit_sha][:files] rescue nil
85
- end
86
-
87
- # returns all commits for a file
88
- def commits_for(file)
89
- @all_files[file]
90
- end
91
-
92
- # returns the shas of the last commits for all
93
- # the files in [] from commit_sha
94
- # files_matcher can be a regexp or an array
95
- def last_commits(commit_sha, files_matcher)
96
- acceptable = commits_from(commit_sha)
97
-
98
- matches = {}
99
-
100
- if files_matcher.is_a? Regexp
101
- files = @all_files.keys.select { |file| file =~ files_matcher }
102
- files_matcher = files
103
- end
104
-
105
- if files_matcher.is_a? Array
106
- # find the last commit for each file in the array
107
- files_matcher.each do |f|
108
- @all_files[f].each do |try|
109
- if acceptable.include?(try)
110
- matches[f] = try
111
- break
112
- end
113
- end if @all_files[f]
114
- end
115
- end
116
-
117
- matches
118
- end
119
-
120
- private
121
-
122
- # read and parse the file-index data
123
- def read_index
124
- f = File.new(@index_file)
125
- @sha_count = 0
126
- @commit_index = {}
127
- @commit_order = {}
128
- @all_files = {}
129
- while line = f.gets
130
- if /^(\w{40})/.match(line)
131
- shas = line.scan(/(\w{40})/)
132
- current_sha = shas.shift.first
133
- parents = shas.map { |sha| sha.first }
134
- @commit_index[current_sha] = {:files => [], :parents => parents }
135
- @commit_order[current_sha] = @sha_count
136
- @sha_count += 1
137
- else
138
- file_name = line.chomp
139
- tree = ''
140
- File.dirname(file_name).split('/').each do |part|
141
- next if part == '.'
142
- tree += part + '/'
143
- @all_files[tree] ||= []
144
- @all_files[tree].unshift(current_sha)
145
- end
146
- @all_files[file_name] ||= []
147
- @all_files[file_name].unshift(current_sha)
148
- @commit_index[current_sha][:files] << file_name
149
- end
150
- end
151
- end
152
-
153
- end
154
-
155
- end
156
- end
157
-
158
-
159
- # benchmark testing on big-ass repos
160
-
161
- if __FILE__ == $0
162
-
163
- #repo = '/Users/schacon/projects/git/.git'
164
- #commit = 'd8933f013a66cc1deadf83a9c24eccb6fee78a35'
165
- #file_list = ["builtin-merge-recursive.c", "git-send-email-script", "git-parse-remote.sh", "builtin-add.c", "merge-base.c", "read-cache.c", "fsck.h", "diff.c", "refs.c", "diffcore-rename.c", "epoch.c", "pack-intersect.c", "fast-import.c", "git-applypatch.sh", "git.spec.in", "rpush.c", "git-clone-script", "utf8.c", "git-external-diff-script", "builtin-init-db.c", "pack-redundant.c", "builtin-diff-index.c", "index.c", "update-index.c", "fetch-clone.c", "pager.c", "diff.h", "unpack-trees.c", "git-browse-help.sh", "git-rename-script", "refs.h", "get-tar-commit-id.c", "git-push.sh", "README", "delta.c", "mailsplit.c", "gitweb.cgi", "var.c", "epoch.h", "gsimm.c", "archive.c", "sideband.c", "utf8.h", "local-fetch.c", "git-request-pull-script", "builtin-send-pack.c", "blob.c", "builtin-ls-remote.c", "pretty.c", "git-diff.sh", "diffcore-break.c", "unpack-trees.h", "git-mv.perl", "interpolate.c", "builtin-diff-files.c", "delta.h", "commit-tree.c", "git-diff-script", "decorate.c", "builtin-name-rev.c", "tree-walk.c", "git-revert-script", "git-sh-setup.sh", "transport.c", "gsimm.h", "archive.h", "count-delta.c", "sideband.h", "git-merge.sh", "git-gui.sh", "git-core.spec.in", "cvs2git.c", "blob.h", "git.sh", "http-push.c", "builtin-commit-tree.c", "diff-helper.c", "builtin-push.c", "interpolate.h", "decorate.h", "git-citool", "dotest", "builtin-verify-tag.c", "git-mergetool.sh", "tree-walk.h", "log-tree.c", "name-rev.c", "applypatch", "cat-file.c", "test-delta.c", "server-info.c", "count-delta.h", "write-tree.c", "local-pull.c", "transport.h", "git-rm.sh", "unpack-objects.c", "xdiff-interface.c", "git-repack-script", "commit.c", "hash-object.c", "git-merge-recursive.py", "git-clone-dumb-http", "thread-utils.c", "git-send-email.perl", "git-whatchanged.sh", "log-tree.h", "builtin-annotate.c", "show-index.c", "pkt-line.c", "ident.c", "git-rebase-script", "name-hash.c", "git-archimport.perl", "xdiff-interface.h", "commit.h", "diff-lib.c", "wt-status.c", "base85.c", "builtin-fetch--tool.c", "unpack-file.c", "builtin-diff-stages.c", "merge-index.c", "color.c", "diff-tree.c", "git-checkout.sh", "thread-utils.h", "grep.c", "pkt-line.h", "builtin-help.c", "test-parse-options.c", "show-files.c", "git.sh.in", "pack.h", "wt-status.h", "git-prune-script", "test-sha1.c", "git-octopus.sh", "dump-cache-tree.c", "git-web--browse.sh", "builtin-upload-tar.c", "builtin-clone.c", "copy.c", "color.h", "show-branch.c", "peek-remote.c", "git-merge-recursive-old.py", "cmd-rename.sh", "git-apply-patch-script", "git-export.c", "git-relink-script", "grep.h", "usage.c", "git-fetch-dumb-http", "fsck-objects.c", "update-cache.c", "diff-stages.c", "patch-ids.c", "builtin-rev-list.c", "builtin-bundle.c", "builtin-show-branch.c", "builtin-pack-refs.c", "tree.c", "git.c", "verify_pack.c", "update-ref.c", "builtin-peek-remote.c", "diffcore-pathspec.c", "git-merge-octopus.sh", "git-show-branches-script", "builtin-archive.c", "builtin-unpack-objects.c", "git-rerere.perl", "walker.c", "builtin-mailsplit.c", "convert.c", "builtin-branch.c", "export.c", "patch-ids.h", "check-builtins.sh", "git-pull-script", "tree.h", "alloc.c", "git-commit.sh", "git-lost-found.sh", "mailmap.c", "rsh.c", "exec_cmd.c", "git-compat-util.h", "ws.c", "rev-list.c", "git-verify-tag.sh", "git-ls-remote-script", "mktree.c", "walker.h", "builtin-blame.c", "builtin-fsck.c", "setup.c", "git-cvsimport-script", "git-add.sh", "symlinks.c", "checkout-index.c", "receive-pack.c", "git-merge-one-file-script", "mailmap.h", "git-cvsimport.perl", "builtin-count.c", "exec_cmd.h", "builtin-stripspace.c", "git-grep.sh", "hash.c", "builtin-prune-packed.c", "git-rebase--interactive.sh", "rsh.h", "match-trees.c", "git-format-patch.sh", "git-push-script", "parse-options.c", "git-status-script", "http-walker.c", "pack-write.c", "git-status.sh", "diff-delta.c", "hash.h", "generate-cmdlist.sh", "config-set.c", "builtin-fetch.c", "ll-merge.c", "t1300-config-set.sh", "ls-tree.c", "write_or_die.c", "builtin-check-ref-format.c", "fetch-pack.c", "git-commit-script", "builtin-describe.c", "parse-options.h", "builtin-checkout.c", "prune-packed.c", "fixup-builtins", "http-fetch.c", "test-absolute-path.c", "git-log.sh", "builtin-merge-ours.c", "git-whatchanged", "pull.c", "merge-tree.c", "ll-merge.h", "builtin.h", "Makefile", "cache-tree.c", "builtin-log.c", "merge-cache.c", "fetch-pack.h", "git-shortlog.perl", "git-bisect-script", "git-am.sh", "check-ref-format.c", "git-count-objects-script", "mkdelta.c", "builtin-diff.c", "merge-recursive.c", "builtin-config.c", "gitenv.c", "describe.c", "git-add--interactive.perl", "pull.h", "builtin-apply.c", "diff-index.c", "ssh-pull.c", "builtin-merge-file.c", "strbuf.c", "git-submodule.sh", "repo-config.c", "run-command.c", "git-applymbox.sh", "cache-tree.h", "builtin-clean.c", "cache.h", "git-prune.sh", "fsck-cache.c", "builtin-remote.c", "sha1_file.c", "shallow.c", "merge-recursive.h", "builtin-checkout-index.c", "git-clone.sh", "builtin-mv.c", "builtin-reflog.c", "lockfile.c", "git-octopus-script", ".mailmap", "strbuf.h", "git-p4import.py", "builtin-repo-config.c", "patch-delta.c", "builtin-merge-base.c", "run-command.h", "check-racy.c", "git-filter-branch.sh", "git-branch.sh", "git-merge-stupid.sh", "diff-files.c", "test-sha1.sh", "COPYING", "git-lost+found.sh", "git-tag.sh", "git-branch-script", "check-files.c", "builtin-reset.c", "builtin-ls-files.c", "builtin-fmt-merge-msg.c", "builtin-for-each-ref.c", "csum-file.c", "git-gc.sh", "git-parse-remote-script", "command-list.txt", "builtin-pack-objects.c", "dir.c", "test-date.c", "builtin-grep.c", "list-objects.c", "clone-pack.c", "git-gui", "convert-cache.c", "git-reset-script", "checkout-cache.c", "git-ls-remote.sh", "read-tree.c", "git-instaweb.sh", "progress.c", "rabinpoly.c", "ls-files.c", "mktag.c", "gitMergeCommon.py", "git-merge-ours.sh", "rpull.c", "git-annotate.perl", "csum-file.h", "builtin-shortlog.c", "builtin-commit.c", "http-pull.c", "git-fetch.sh", "apply.c", "git-add-script", "dir.h", "diff-tree-helper.c", "list-objects.h", "rev-tree.c", "builtin-tar-tree.c", "progress.h", "builtin-pickaxe.c", "git-merge-fredrik.py", "path.c", "builtin-diff-tree.c", "rabinpoly.h", "builtin-ls-tree.c", "tar.h", "trace.c", "graph.c", "ssh-fetch.c", "show-diff.c", "sha1-lookup.c", "builtin-revert.c", "builtin-symbolic-ref.c", "builtin-write-tree.c", "git-sh-setup-script", "rev-cache.c", "blame.c", "builtin-mailinfo.c", "git-cherry", "git-resolve-script", "INSTALL", "git-findtags.perl", "diffcore-delta.c", "entry.c", "git-applypatch", "connect.c", "tar-tree.c", "graph.h", "missing-revs.c", "builtin-fast-export.c", "sha1-lookup.h", "rev-parse.c", "configure.ac", "rev-cache.h", "build-rev-cache.c", "reachable.c", "index-pack.c", "git", "send-pack.c", "git-cherry.sh", "git-tag-script", "revision.c", "CREDITS-GEN", "bundle.c", "mailinfo.c", "symbolic-ref.c", "attr.c", "git-archimport-script", "archive-zip.c", "diff-cache.c", "fetch.c", "builtin-gc.c", "git-remote.perl", "path-list.c", "ssh-upload.c", "reachable.h", "diff-no-index.c", "diffcore.h", "send-pack.h", "tree-diff.c", "git-checkout-script", "pack-revindex.c", "show-rev-cache.c", "TODO", "revision.h", "bundle.h", "unresolve.c", "git-deltafy-script", "git-relink.perl", "archive-tar.c", "attr.h", "git-resolve.sh", "config.mak.in", "builtin-update-index.c", "convert-objects.c", "fetch.h", "builtin-runstatus.c", "quote.c", "init-db.c", "git-shortlog", "builtin-prune.c", "builtin-rerere.c", "verify-pack.c", "gitk", "patch-id.c", ".gitattributes", "date.c", "git-format-patch-script", "path-list.h", "pack-revindex.h", "GIT-VERSION-GEN", "combine-diff.c", "environment.c", "git-cvsserver.perl", "git-repack.sh", "diffcore-order.c", "reflog-walk.c", "config.c", "test-match-trees.c", "git-svnimport.perl", "quote.h", "write-blob.c", "diffcore-pickaxe.c", "builtin-update-ref.c", "stripspace.c", "help.c", "pack-objects.c", "branch.c", "git-verify-tag-script", "TEST", "daemon.c", "remote.c", "git-log-script", "git-pull.sh", "git-quiltimport.sh", "git-count-objects.sh", "reflog-walk.h", "git-applymbox", "builtin-show-ref.c", "RelNotes", "git-fmt-merge-msg.perl", "git-rebase.sh", "git-parse-remote", "git-browse--help.sh", "git-stash.sh", "alias.c", "branch.h", "gitweb.pl", "builtin-upload-archive.c", "builtin-cat-file.c", "sha1_name.c", "http.c", "test-chmtime.c", "remote.h", "ssh-push.c", "tag.c", "update-server-info.c", "git-cvsexportcommit.perl", "builtin-check-attr.c", "git-revert.sh", "builtin-verify-pack.c", "object.c", "git-merge-resolve.sh", "shortlog.h", "git-fetch-script", "test-genrandom.c", "shell.c", "builtin-rm.c", "builtin-zip-tree.c", "upload-pack.c", "git-rename.perl", ".gitignore", "tag.h", "http.h", "git-request-pull.sh", "object.h", "git-svn.perl", "builtin-fetch-pack.c", "git-bisect.sh", "pack-check.c", "builtin-rev-parse.c", "object-refs.c", "test-gsimm.c", "builtin-read-tree.c", "git-help--browse.sh", "merge-file.c", "fsck.c", "builtin-tag.c", "builtin-http-fetch.c", "builtin-count-objects.c", "git-reset.sh", "git-clean.sh", "git-merge-one-file.sh", "ctype.c", "git-mktag.c", "imap-send.c"]
166
-
167
- repo = '/Users/schacon/projects/grit/.git'
168
- commit = 'c87612bc84c95ba9df17674d911dde10f34fefaa'
169
-
170
- require 'benchmark'
171
-
172
- Benchmark.bm(20) do |x|
173
- x.report('index build') do
174
- i = Grit::GitRuby::FileIndex.new(repo)
175
- end
176
- x.report('commit count') do
177
- i = Grit::GitRuby::FileIndex.new(repo)
178
- i.count(commit)
179
- end
180
- x.report('commits list') do
181
- i = Grit::GitRuby::FileIndex.new(repo)
182
- i.commits_from(commit)
183
- end
184
- x.report('last commits') do
185
- i = Grit::GitRuby::FileIndex.new(repo)
186
- #arr = i.last_commits(commit, file_list)
187
- arr = i.last_commits(commit, /^[^\/]*$/)
188
- end
189
- end
190
- end
191
-
192
-
193
-