Skip to content

Commit 8b3bd25

Browse files
authored
Do not call chomp! on an IO object (#500)
Signed-off-by: James Couball <jcouball@yahoo.com>
1 parent c81cc03 commit 8b3bd25

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/git/lib.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,15 +1050,12 @@ def command(cmd, *opts, &block)
10501050
@logger.debug(output)
10511051
end
10521052

1053-
if exitstatus > 1 || (exitstatus == 1 && output != '')
1054-
raise Git::GitExecuteError.new(git_cmd + ':' + output.to_s)
1055-
end
1053+
raise Git::GitExecuteError, "#{git_cmd}:#{output}" if
1054+
exitstatus > 1 || (exitstatus == 1 && output != '')
10561055

1057-
if command_opts[:chomp]
1058-
output.chomp! if output
1059-
end
1056+
output.chomp! if output && command_opts[:chomp] && !block_given?
10601057

1061-
return output
1058+
output
10621059
end
10631060

10641061
# Takes the diff command line output (as Array) and parse it into a Hash

0 commit comments

Comments
 (0)