Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: mojombo/grit
base: master
...
head fork: ept/grit
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 2 contributors
Showing with 127 additions and 4 deletions.
  1. +113 −0 .specification
  2. +9 −0 init.rb
  3. +4 −3 lib/grit/git.rb
  4. +1 −1  lib/grit/repo.rb
View
113 .specification
@@ -0,0 +1,113 @@
+--- !ruby/object:Gem::Specification
+name: grit
+version: !ruby/object:Gem::Version
+ version: 1.1.1
+platform: ruby
+authors:
+- Tom Preston-Werner
+- Scott Chacon
+autorequire:
+bindir: bin
+cert_chain: []
+
+date: 2009-03-31 00:00:00 +01:00
+default_executable:
+dependencies:
+- !ruby/object:Gem::Dependency
+ name: mime-types
+ type: :runtime
+ version_requirement:
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: "1.15"
+ version:
+- !ruby/object:Gem::Dependency
+ name: diff-lcs
+ type: :runtime
+ version_requirement:
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: 1.1.2
+ version:
+description: Grit is a Ruby library for extracting information from a git repository in an object oriented manner.
+email: tom@mojombo.com
+executables: []
+
+extensions: []
+
+extra_rdoc_files:
+- README.md
+- LICENSE
+files:
+- API.txt
+- History.txt
+- README.md
+- VERSION.yml
+- lib/grit
+- lib/grit/actor.rb
+- lib/grit/blame.rb
+- lib/grit/blob.rb
+- lib/grit/commit.rb
+- lib/grit/commit_stats.rb
+- lib/grit/config.rb
+- lib/grit/diff.rb
+- lib/grit/errors.rb
+- lib/grit/git-ruby
+- lib/grit/git-ruby/commit_db.rb
+- lib/grit/git-ruby/file_index.rb
+- lib/grit/git-ruby/git_object.rb
+- lib/grit/git-ruby/internal
+- lib/grit/git-ruby/internal/file_window.rb
+- lib/grit/git-ruby/internal/loose.rb
+- lib/grit/git-ruby/internal/pack.rb
+- lib/grit/git-ruby/internal/raw_object.rb
+- lib/grit/git-ruby/object.rb
+- lib/grit/git-ruby/repository.rb
+- lib/grit/git-ruby.rb
+- lib/grit/git.rb
+- lib/grit/index.rb
+- lib/grit/lazy.rb
+- lib/grit/merge.rb
+- lib/grit/ref.rb
+- lib/grit/repo.rb
+- lib/grit/ruby1.9.rb
+- lib/grit/status.rb
+- lib/grit/submodule.rb
+- lib/grit/tag.rb
+- lib/grit/tree.rb
+- lib/grit.rb
+- lib/open3_detach.rb
+- LICENSE
+has_rdoc: true
+homepage: http://github.com/mojombo/grit
+post_install_message:
+rdoc_options:
+- --inline-source
+- --charset=UTF-8
+require_paths:
+- lib
+required_ruby_version: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: "0"
+ version:
+required_rubygems_version: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: "0"
+ version:
+requirements: []
+
+rubyforge_project: grit
+rubygems_version: 1.3.1
+signing_key:
+specification_version: 2
+summary: Grit is a Ruby library for extracting information from a git repository in an object oriented manner.
+test_files: []
+
View
9 init.rb
@@ -0,0 +1,9 @@
+
+require_options = ["grit"]
+if require_lib = require_options.find { |path| File.directory?(File.join(File.dirname(__FILE__), 'lib', path)) }
+ require File.join(File.dirname(__FILE__), 'lib', require_lib)
+else
+ puts msg = "ERROR: Please update #{File.expand_path __FILE__} with the require path for linked RubyGem grit"
+ exit
+end
+
View
7 lib/grit/git.rb
@@ -29,10 +29,11 @@ def self.with_timeout(timeout = 10.seconds)
Grit::Git.git_timeout = old_timeout
end
- attr_accessor :git_dir, :bytes_read
+ attr_accessor :git_dir, :bytes_read, :work_tree
- def initialize(git_dir)
+ def initialize(git_dir, work_tree = nil)
self.git_dir = git_dir
+ self.work_tree = work_tree
self.bytes_read = 0
end
@@ -62,7 +63,7 @@ def run(prefix, cmd, postfix, options, args)
opt_args = transform_options(options)
ext_args = args.reject { |a| a.empty? }.map { |a| (a == '--' || a[0].chr == '|') ? a : "'#{e(a)}'" }
- call = "#{prefix}#{Git.git_binary} --git-dir='#{self.git_dir}' #{cmd.to_s.gsub(/_/, '-')} #{(opt_args + ext_args).join(' ')}#{e(postfix)}"
+ call = "#{prefix}#{Git.git_binary} --git-dir='#{self.git_dir}' " + (self.work_tree ? "--work-tree=#{self.work_tree} " : "") + "#{cmd.to_s.gsub(/_/, '-')} #{(opt_args + ext_args).join(' ')}#{e(postfix)}"
Grit.log(call) if Grit.debug
response, err = timeout ? sh(call) : wild_sh(call)
Grit.log(response) if Grit.debug
View
2  lib/grit/repo.rb
@@ -36,7 +36,7 @@ def initialize(path, options = {})
raise NoSuchPathError.new(epath)
end
- self.git = Git.new(self.path)
+ self.git = Git.new(self.path, self.working_dir)
end
# Does nothing yet...

No commit comments for this range

Something went wrong with that request. Please try again.