Skip to content

Commit 13db9b9

Browse files
author
Roberto Decurnex
committed
Adding Ruby 2.1.2 to Travis
Updating index opts tests to use a Fixnum instead of the 1e4 syntax (Float), no longer supported by Git git/git@e3fa568c
1 parent 8425a6b commit 13db9b9

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ rvm:
44
- 1.9.2
55
- 1.9.3
66
- 2.0.0
7-
- 2.1
7+
- 2.1.1
8+
- 2.1.2
89
- jruby-18mode
910
- jruby-19mode
1011
- ree

lib/git/lib.rb

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -739,31 +739,29 @@ def command(cmd, opts = [], chdir = true, redirect = '', &block)
739739
ENV['GIT_INDEX_FILE'] = @git_index_file
740740

741741
path = @git_work_dir || @git_dir || @path
742-
742+
743743
opts = [opts].flatten.map {|s| escape(s) }.join(' ')
744744

745745
git_cmd = "git #{cmd} #{opts} #{redirect} 2>&1"
746746

747-
out = nil
747+
output = nil
748+
748749
if chdir && (Dir.getwd != path)
749-
Dir.chdir(path) { out = run_command(git_cmd, &block) }
750+
Dir.chdir(path) { output = run_command(git_cmd, &block) }
750751
else
751-
752-
out = run_command(git_cmd, &block)
752+
output = run_command(git_cmd, &block)
753753
end
754754

755755
if @logger
756756
@logger.info(git_cmd)
757-
@logger.debug(out)
757+
@logger.debug(output)
758758
end
759759

760-
if $?.exitstatus > 0
761-
if $?.exitstatus == 1 && out == ''
762-
return ''
763-
end
764-
raise Git::GitExecuteError.new(git_cmd + ':' + out.to_s)
760+
if $?.exitstatus > 1 || ($?.exitstatus == 1 && output != '')
761+
raise Git::GitExecuteError.new(git_cmd + ':' + output.to_s)
765762
end
766-
out
763+
764+
return output
767765
end
768766

769767
# Takes the diff command line output (as Array) and parse it into a Hash
@@ -821,11 +819,9 @@ def log_path_options(opts)
821819
end
822820

823821
def run_command(git_cmd, &block)
824-
if block_given?
825-
IO.popen(git_cmd, &block)
826-
else
827-
`#{git_cmd}`.chomp
828-
end
822+
return IO.popen(git_cmd, &block) if block_given?
823+
824+
`#{git_cmd}`.chomp
829825
end
830826

831827
def escape(s)

tests/units/test_index_ops.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ def test_revert
9494
g.commit("second-commit")
9595
g.gcommit('HEAD')
9696

97-
commits = g.log(1e4).count
97+
commits = g.log(10000).count
9898
g.revert(first_commit.sha)
99-
assert_equal(commits + 1, g.log(1e4).count)
99+
assert_equal(commits + 1, g.log(10000).count)
100100
assert(!File.exist?('test-file2'))
101101
end
102102
end

0 commit comments

Comments
 (0)