@@ -495,7 +495,7 @@ def show(objectish=nil, path=nil)
495
495
496
496
arr_opts << ( path ? "#{ objectish } :#{ path } " : objectish )
497
497
498
- command ( 'show' , arr_opts . compact )
498
+ command ( 'show' , arr_opts . compact , chomp : false )
499
499
end
500
500
501
501
## WRITE COMMANDS ##
@@ -934,12 +934,12 @@ def with_custom_env_variables(&block)
934
934
end
935
935
936
936
def command ( cmd , *opts , &block )
937
- command_opts = { redirect : '' }
937
+ command_opts = { chomp : true , redirect : '' }
938
938
if opts . last . is_a? ( Hash )
939
939
command_opts . merge! ( opts . pop )
940
940
end
941
941
command_opts . keys . each do |k |
942
- raise ArgumentError . new ( "Unsupported option: #{ k } " ) unless [ :redirect ] . include? ( k )
942
+ raise ArgumentError . new ( "Unsupported option: #{ k } " ) unless [ :chomp , : redirect] . include? ( k )
943
943
end
944
944
945
945
default_command_opts = { redirect : '' }
@@ -978,6 +978,10 @@ def command(cmd, *opts, &block)
978
978
raise Git ::GitExecuteError . new ( git_cmd + ':' + output . to_s )
979
979
end
980
980
981
+ if command_opts [ :chomp ]
982
+ output . chomp! if output
983
+ end
984
+
981
985
return output
982
986
end
983
987
@@ -1037,7 +1041,7 @@ def log_path_options(opts)
1037
1041
def run_command ( git_cmd , &block )
1038
1042
return IO . popen ( git_cmd , &block ) if block_given?
1039
1043
1040
- `#{ git_cmd } ` . chomp
1044
+ `#{ git_cmd } `
1041
1045
end
1042
1046
1043
1047
def escape ( s )
0 commit comments