File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -372,12 +372,15 @@ def merge(destination, content) #:nodoc:
372372 Tempfile . open ( [ File . basename ( destination ) , File . extname ( destination ) ] , File . dirname ( destination ) ) do |temp |
373373 temp . write content
374374 temp . rewind
375- system ( merge_tool , temp . path , destination )
375+ system ( * merge_tool , temp . path , destination )
376376 end
377377 end
378378
379379 def merge_tool #:nodoc:
380- @merge_tool ||= ENV [ "THOR_MERGE" ] || "git difftool --no-index"
380+ @merge_tool ||= begin
381+ require "shellwords"
382+ Shellwords . split ( ENV [ "THOR_MERGE" ] || "git difftool --no-index" )
383+ end
381384 end
382385 end
383386 end
Original file line number Diff line number Diff line change @@ -564,6 +564,13 @@ def #456 Lanç...
564564 capture ( :stdout ) { shell . file_collision ( "foo" ) { } }
565565 end
566566
567+ it "invokes the merge tool with arguments when THOR_MERGE contains them" do
568+ allow ( ENV ) . to receive ( :[] ) . with ( "THOR_MERGE" ) . and_return ( "nvim -d" )
569+ expect ( Thor ::LineEditor ) . to receive ( :readline ) . and_return ( "m" )
570+ expect ( shell ) . to receive ( :system ) . with ( "nvim" , "-d" , /foo/ , "foo" )
571+ capture ( :stdout ) { shell . file_collision ( "foo" ) { } }
572+ end
573+
567574 it "show warning if user chooses merge but merge tool is not specified" do
568575 allow ( shell ) . to receive ( :merge_tool ) . and_return ( "" )
569576 expect ( Thor ::LineEditor ) . to receive ( :readline ) . and_return ( "m" )
You can’t perform that action at this time.
0 commit comments