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 b4d7264 Simplify
b4d7264 is described below
commit b4d7264a9ade24309b8c989e0a739b7cf929d49d
Author: Sebb <[email protected]>
AuthorDate: Tue Sep 22 18:49:22 2020 +0100
Simplify
---
lib/whimsy/asf/documents.rb | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/lib/whimsy/asf/documents.rb b/lib/whimsy/asf/documents.rb
index b82f5ea..cb46c34 100644
--- a/lib/whimsy/asf/documents.rb
+++ b/lib/whimsy/asf/documents.rb
@@ -143,11 +143,9 @@ module ASF
# or
# nil, nil if not found
def self.findpath(person)
- path = file = nil
- file = self.find(person)
- if file
- path = self.svnpath!(file)
- end
+ path = nil
+ file = find(person)
+ path = svnpath!(file) if file
[path, file]
end
@@ -157,17 +155,20 @@ module ASF
# return the file name or nil if the file is not in the directory
def self.extractfilenamefrom(rooturl, fileurl)
return nil unless fileurl
+
# does the root match the file url?
index = fileurl.index(rooturl)
- if (index == 0)
- # root matches, return file name (end of fileurl)
- fileurl[rooturl.length..-1]
- end
+ return nil unless index.zero?
+
+ # root matches, return file name (end of fileurl)
+ fileurl[rooturl.length..-1]
end
+
# Extract the file name if it is in emeritus directory
# nil if it is not in this directory
def self.extractfilename(fileurl)
return nil unless fileurl
+
root_url = ASF::SVN.svnurl(@base) + '/'
extractfilenamefrom(root_url, fileurl)
end