Skip to content

Commit 97e7f66

Browse files
author
root
committed
Add comments
1 parent 2a70294 commit 97e7f66

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: lib/redmine_git_hosting/patches/repository_git_patch.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ def repo_path_to_git_cache_id(repo_path)
7474
# form, it will still identify the repository (as long as there are not more than
7575
# one repo with the same identifier.
7676
#
77-
# Note about pre Redmine 1.4 -- only look at last component and try to match to a path.
78-
# If that doesn't work, return nil.
77+
# Example of data captured by regex :
78+
# <MatchData "test/test2/test3/test4/test5.git" 1:"test4/" 2:"test4" 3:"test5" 4:".git">
79+
# <MatchData "blabla2.git" 1:nil 2:nil 3:"blabla2" 4:".git">
80+
7981
def find_by_path(path, flags = {})
8082
if parseit = path.match(/^.*?(([^\/]+)\/)?([^\/]+?)(\.git)?$/)
8183
if proj = Project.find_by_identifier(parseit[3])
@@ -84,7 +86,7 @@ def find_by_path(path, flags = {})
8486
elsif repo_ident_unique? || flags[:loose] && parseit[2].nil?
8587
find_by_identifier(parseit[3])
8688
elsif parseit[2] && proj = Project.find_by_identifier(parseit[2])
87-
find_by_identifier_and_project_id(parseit[3],proj.id) ||
89+
find_by_identifier_and_project_id(parseit[3], proj.id) ||
8890
flags[:loose] && find_by_identifier(parseit[3]) || nil
8991
else
9092
nil

0 commit comments

Comments
 (0)