davetron5000-grit 1.1.2 → 1.1.3
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.
- data/lib/grit/git.rb +3 -2
- data/test/test_git.rb +5 -5
- metadata +2 -2
data/lib/grit/git.rb
CHANGED
@@ -29,10 +29,11 @@ module Grit
|
|
29
29
|
Grit::Git.git_timeout = old_timeout
|
30
30
|
end
|
31
31
|
|
32
|
-
attr_accessor :git_dir, :bytes_read
|
32
|
+
attr_accessor :git_dir, :bytes_read, :work_tree
|
33
33
|
|
34
34
|
def initialize(git_dir)
|
35
35
|
self.git_dir = git_dir
|
36
|
+
self.work_tree = git_dir.gsub(/\/\.git$/,'')
|
36
37
|
self.bytes_read = 0
|
37
38
|
end
|
38
39
|
|
@@ -62,7 +63,7 @@ module Grit
|
|
62
63
|
opt_args = transform_options(options)
|
63
64
|
ext_args = args.reject { |a| a.empty? }.map { |a| (a == '--' || a[0].chr == '|') ? a : "'#{e(a)}'" }
|
64
65
|
|
65
|
-
call = "#{prefix}#{Git.git_binary} --git-dir='#{self.git_dir}' #{cmd.to_s.gsub(/_/, '-')} #{(opt_args + ext_args).join(' ')}#{e(postfix)}"
|
66
|
+
call = "#{prefix}#{Git.git_binary} --work-tree='#{self.work_tree}' --git-dir='#{self.git_dir}' #{cmd.to_s.gsub(/_/, '-')} #{(opt_args + ext_args).join(' ')}#{e(postfix)}"
|
66
67
|
Grit.log(call) if Grit.debug
|
67
68
|
response, err = timeout ? sh(call) : wild_sh(call)
|
68
69
|
Grit.log(response) if Grit.debug
|
data/test/test_git.rb
CHANGED
@@ -63,22 +63,22 @@ class TestGit < Test::Unit::TestCase
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def test_it_really_shell_escapes_arguments_to_the_git_shell
|
66
|
-
@git.expects(:sh).with("#{Git.git_binary} --git-dir='#{@git.git_dir}' foo --bar='bazz\\'er'")
|
66
|
+
@git.expects(:sh).with("#{Git.git_binary} --work-tree='#{@git.work_tree}' --git-dir='#{@git.git_dir}' foo --bar='bazz\\'er'")
|
67
67
|
@git.foo(:bar => "bazz'er")
|
68
|
-
@git.expects(:sh).with("#{Git.git_binary} --git-dir='#{@git.git_dir}' bar -x 'quu\\'x'")
|
68
|
+
@git.expects(:sh).with("#{Git.git_binary} --work-tree='#{@git.work_tree}' --git-dir='#{@git.git_dir}' bar -x 'quu\\'x'")
|
69
69
|
@git.bar(:x => "quu'x")
|
70
70
|
end
|
71
71
|
|
72
72
|
def test_it_shell_escapes_the_standalone_argument
|
73
|
-
@git.expects(:sh).with("#{Git.git_binary} --git-dir='#{@git.git_dir}' foo 'bar\\'s'")
|
73
|
+
@git.expects(:sh).with("#{Git.git_binary} --work-tree='#{@git.work_tree}' --git-dir='#{@git.git_dir}' foo 'bar\\'s'")
|
74
74
|
@git.foo({}, "bar's")
|
75
75
|
|
76
|
-
@git.expects(:sh).with("#{Git.git_binary} --git-dir='#{@git.git_dir}' foo 'bar' '\\; echo \\'noooo\\''")
|
76
|
+
@git.expects(:sh).with("#{Git.git_binary} --work-tree='#{@git.work_tree}' --git-dir='#{@git.git_dir}' foo 'bar' '\\; echo \\'noooo\\''")
|
77
77
|
@git.foo({}, "bar", "; echo 'noooo'")
|
78
78
|
end
|
79
79
|
|
80
80
|
def test_piping_should_work_on_1_9
|
81
|
-
@git.expects(:sh).with("#{Git.git_binary} --git-dir='#{@git.git_dir}' archive 'master' | gzip")
|
81
|
+
@git.expects(:sh).with("#{Git.git_binary} --work-tree='#{@git.work_tree}' --git-dir='#{@git.git_dir}' archive 'master' | gzip")
|
82
82
|
@git.archive({}, "master", "| gzip")
|
83
83
|
end
|
84
84
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: davetron5000-grit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
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-06-
|
13
|
+
date: 2009-06-20 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|