Skip to content

Commit

Permalink
Merge commit '1ab3ab760dc144d252299afb729269aa8d3a1c48' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Mar 1, 2009
2 parents 94d27ea + 1ab3ab7 commit fd39630
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/grit/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ def initialize(command = nil, bytes_read = nil)
include GitRuby

class << self
attr_accessor :git_binary, :git_timeout
attr_accessor :git_binary, :git_timeout, :git_max_size
end

self.git_binary = "/usr/bin/env git"
self.git_timeout = 10
self.git_binary = "/usr/bin/env git"
self.git_timeout = 10
self.git_max_size = 5242880 # 5.megabytes

def self.with_timeout(timeout = 10.seconds)
old_timeout = Grit::Git.git_timeout
Expand Down Expand Up @@ -75,7 +76,7 @@ def sh(command)
Timeout.timeout(self.class.git_timeout) do
while tmp = stdout.read(1024)
ret += tmp
if (@bytes_read += tmp.size) > 5242880 # 5.megabytes
if (@bytes_read += tmp.size) > self.class.git_max_size
bytes = @bytes_read
@bytes_read = 0
raise GitTimeout.new(command, bytes)
Expand Down

0 comments on commit fd39630

Please sign in to comment.