whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Use array for commands so args can have spaces
Date Tue, 02 Jun 2020 15:37:31 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 28c2df1  Use array for commands so args can have spaces
28c2df1 is described below

commit 28c2df1c46090ef504a2fa0227ee5bed94429abc
Author: Sebb <sebb@apache.org>
AuthorDate: Tue Jun 2 16:37:19 2020 +0100

    Use array for commands so args can have spaces
---
 lib/whimsy/asf/svn.rb | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 140d048..2b05d1e 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -490,12 +490,15 @@ module ASF
     # the block can return additional info, which is used 
     # to generate extra commands to pass to svnmucc
     # which are included in the same commit
+    # The extra parameter is an array of commands
+    # These must themselves be arrays to ensure correct processing of white-space
     # For example:
     #   ASF::SVN.svnmucc(path,message,env,_) do |text|
     #     out = '...'
     #     extra = []
-    #     extra << 'mv url1 url2'
-    #     extra << 'rm url3'
+    #     url1 = 'https://svn.../' # etc
+    #     extra << ['mv',url1,url2]
+    #     extra << ['rm',url3]
     #     [out, extra]
     #   end
     def self.svnmucc(path, msg, env, _)
@@ -535,12 +538,15 @@ module ASF
 
         # create the command file:
         cmdfile = Tempfile.new('svnmucc_input', tmpdir)
+        # upload the updated file
         cmdfile.puts(['put',tmpfile,fileurl].join("\n")) # one arg per line
         cmdfile.puts('')
 
         # add the extra commands
         extra.each do |cmd|
-          cmdfile.puts(cmd.gsub(/ +/,"\n"))
+          cmd.each do |arg|
+            cmdfile.puts(arg)
+          end
           cmdfile.puts('')
         end
         cmdfile.rewind


Mime
View raw message