299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
|
# File 'lib/braid/operations.rb', line 299
def apply(diff, *args)
status, err = nil, nil
command = "git apply --index --whitespace=nowarn #{args.join(' ')} -"
if USE_OPEN3
Open3.popen3(command) do |stdin, stdout, stderr, wait_thread|
stdin.puts(diff)
stdin.close
err = stderr.read
status = wait_thread.value if wait_thread end
status = $?.exitstatus if status.nil?
else
status = Open4.popen4(command) do |pid, stdin, stdout, stderr|
stdin.puts(diff)
stdin.close
err = stderr.read
end.exitstatus
end
raise ShellExecutionError, err unless status == 0
true
end
|