You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/06/05 15:51:32 UTC

[whimsy] branch master updated: Add password-from-stdin checking

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 8626686  Add password-from-stdin checking
8626686 is described below

commit 8626686c188e517f0f4016c65ab47cc11ad8ca31
Author: Sebb <se...@apache.org>
AuthorDate: Fri Jun 5 16:51:17 2020 +0100

    Add password-from-stdin checking
---
 lib/spec/lib/svn_spec.rb |  9 ++++++++-
 lib/whimsy/asf/svn.rb    | 13 +++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/lib/spec/lib/svn_spec.rb b/lib/spec/lib/svn_spec.rb
index 4380fd7..7f163ea 100644
--- a/lib/spec/lib/svn_spec.rb
+++ b/lib/spec/lib/svn_spec.rb
@@ -217,5 +217,12 @@ describe ASF::SVN do
       expect(content.size).to be > 1000 # need a better test
     end
   end
-      
+
+  describe "ASF::SVN.passwordStdinOK?" do
+    it "passwordStdinOK? should return true or false" do
+      res = ASF::SVN.passwordStdinOK?
+      expect(res).to be(true).or be(false)
+    end
+  end
+
 end
\ No newline at end of file
diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index bbed5a8..bf3c215 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -24,6 +24,7 @@ module ASF
       untaint
     @@repository_mtime = nil
     @@repository_entries = nil
+    @@svnHasPasswordFromStdin = nil
 
     # a hash of local working copies of Subversion repositories.  Keys are
     # subversion paths; values are file paths.
@@ -709,6 +710,18 @@ module ASF
       end
     end
 
+    # Does this host's installation of SVN support --password-from-stdin?
+    def self.passwordStdinOK?()
+      return @@svnHasPasswordFromStdin if @@svnHasPasswordFromStdin
+        out,err = self.svn('help','cat', {args: '-v'})
+        if out
+          @@svnHasPasswordFromStdin = out.include? '--password-from-stdin'
+        else
+          @@svnHasPasswordFromStdin = false
+        end
+      @@svnHasPasswordFromStdin
+    end
+
     private
     
     def self.listingNames(name)