Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Further Ruby 1.9 compat; IO#getc can return a string in 1.9

  • Loading branch information...
commit 794dcb628b0ca6a3be35b5f4359946cb51e1f654 1 parent a17e860
@js js authored
View
10 lib/grit/git-ruby/git_object.rb
@@ -179,8 +179,14 @@ def raw
def self.read_bytes_until(io, char)
string = ''
- while ((next_char = io.getc.chr) != char) && !io.eof
- string += next_char
+ if RUBY_VERSION > '1.9'
+ while ((next_char = io.getc) != char) && !io.eof
+ string += next_char
+ end
+ else
+ while ((next_char = io.getc.chr) != char) && !io.eof
+ string += next_char
+ end
end
string
end
View
10 lib/grit/git-ruby/object.rb
@@ -163,8 +163,14 @@ def raw
def self.read_bytes_until(io, char)
string = ''
- while ((next_char = io.getc.chr) != char) && !io.eof
- string += next_char
+ if RUBY_VERSION > '1.9'
+ while ((next_char = io.getc) != char) && !io.eof
+ string += next_char
+ end
+ else
+ while ((next_char = io.getc.chr) != char) && !io.eof
+ string += next_char
+ end
end
string
end
View
5 test/test_git.rb
@@ -76,4 +76,9 @@ def test_it_shell_escapes_the_standalone_argument
@git.expects(:sh).with("#{Git.git_binary} --git-dir='#{@git.git_dir}' foo 'bar' '\\; echo \\'noooo\\''")
@git.foo({}, "bar", "; echo 'noooo'")
end
+
+ def test_piping_should_work_on_1_9
+ @git.expects(:sh).with("#{Git.git_binary} --git-dir='#{@git.git_dir}' archive 'master' | gzip")
+ @git.archive({}, "master", "| gzip")
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.