lib/grit/git.rb in gitlab-grit-2.6.9 vs lib/grit/git.rb in gitlab-grit-2.6.10

- old
+ new

@@ -91,13 +91,13 @@ Grit::Git.git_timeout = old_timeout end attr_accessor :git_dir, :bytes_read, :work_tree - def initialize(git_dir) + def initialize(git_dir, options={}) self.git_dir = git_dir - self.work_tree = git_dir.gsub(/\/\.git$/,'') + self.work_tree = options[:work_tree] self.bytes_read = 0 end def shell_escape(str) str.to_s.gsub("'", "\\\\'").gsub(";", '\\;') @@ -318,26 +318,25 @@ # more options input = options.delete(:input) timeout = options.delete(:timeout); timeout = true if timeout.nil? base = options.delete(:base); base = true if base.nil? - chdir = options.delete(:chdir) # build up the git process argv argv = [] argv << Git.git_binary argv << "--git-dir=#{git_dir}" if base + argv << "--work-tree=#{work_tree}" if work_tree argv << cmd.to_s.tr('_', '-') argv.concat(options_to_argv(options)) argv.concat(args) # run it and deal with fallout Grit.log(argv.join(' ')) if Grit.debug process = Child.new(env, *(argv + [{ :input => input, - :chdir => chdir, :timeout => (Grit::Git.git_timeout if timeout == true), :max => (Grit::Git.git_max_size if timeout == true) }])) Grit.log(process.out) if Grit.debug Grit.log(process.err) if Grit.debug