@@ -492,7 +492,7 @@ def show(objectish=nil, path=nil)
492
492
493
493
arr_opts << ( path ? "#{ objectish } :#{ path } " : objectish )
494
494
495
- command ( 'show' , arr_opts . compact )
495
+ command ( 'show' , arr_opts . compact , chomp : false )
496
496
end
497
497
498
498
## WRITE COMMANDS ##
@@ -923,12 +923,12 @@ def with_custom_env_variables(&block)
923
923
end
924
924
925
925
def command ( cmd , *opts , &block )
926
- command_opts = { redirect : '' }
926
+ command_opts = { chomp : true , redirect : '' }
927
927
if opts . last . is_a? ( Hash )
928
928
command_opts . merge! ( opts . pop )
929
929
end
930
930
command_opts . keys . each do |k |
931
- raise ArgumentError . new ( "Unsupported option: #{ k } " ) unless %i[ redirect ] . include? ( k )
931
+ raise ArgumentError . new ( "Unsupported option: #{ k } " ) unless %i[ chomp redirect ] . include? ( k )
932
932
end
933
933
934
934
default_command_opts = { redirect : '' }
@@ -967,6 +967,10 @@ def command(cmd, *opts, &block)
967
967
raise Git ::GitExecuteError . new ( git_cmd + ':' + output . to_s )
968
968
end
969
969
970
+ if command_opts [ :chomp ]
971
+ output . chomp! if output
972
+ end
973
+
970
974
return output
971
975
end
972
976
@@ -1026,7 +1030,7 @@ def log_path_options(opts)
1026
1030
def run_command ( git_cmd , &block )
1027
1031
return IO . popen ( git_cmd , &block ) if block_given?
1028
1032
1029
- `#{ git_cmd } ` . chomp
1033
+ `#{ git_cmd } `
1030
1034
end
1031
1035
1032
1036
def escape ( s )
0 commit comments