File tree 1 file changed +5
-3
lines changed
lib/redmine_git_hosting/patches
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -74,8 +74,10 @@ def repo_path_to_git_cache_id(repo_path)
74
74
# form, it will still identify the repository (as long as there are not more than
75
75
# one repo with the same identifier.
76
76
#
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
+
79
81
def find_by_path ( path , flags = { } )
80
82
if parseit = path . match ( /^.*?(([^\/ ]+)\/ )?([^\/ ]+?)(\. git)?$/ )
81
83
if proj = Project . find_by_identifier ( parseit [ 3 ] )
@@ -84,7 +86,7 @@ def find_by_path(path, flags = {})
84
86
elsif repo_ident_unique? || flags [ :loose ] && parseit [ 2 ] . nil?
85
87
find_by_identifier ( parseit [ 3 ] )
86
88
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 ) ||
88
90
flags [ :loose ] && find_by_identifier ( parseit [ 3 ] ) || nil
89
91
else
90
92
nil
You can’t perform that action at this time.
0 commit comments