File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 44
44
45
45
_RE_PORT = r":(?P<port>\d+)"
46
46
47
- _RE_PATHNAME = r"(?P<path>(([\w\-\~\ .]+)/)*?(((?P<owner>( [\w\-\.]+/?)+ )/)?(?P<name>[\w\-\.]+)(\.git)?)?)/*"
47
+ _RE_PATHNAME = r"(?P<path>((\~ [\w\-\.]+)/)*?(((?P<owner>[\w\-\./]+? )/)?(?P<name>[\w\-\.]+)(\.git)?)?)/*"
48
48
49
49
_RE_PATHNAME_WITH_GITLAB = (
50
50
r"(?P<path>((((gitlab/){0,1}|([\w\-\~\.]+/)*?)(?P<owner>([\w\-\.]+/)*[\w\-\.]+)/)?"
Original file line number Diff line number Diff line change 18
18
"""Git regex tests."""
19
19
20
20
import os
21
+ import time
21
22
22
23
import pytest
23
24
287
288
"port" : "1234" ,
288
289
"env" : "https://gitlab.example.com:1234/" ,
289
290
},
291
+ {
292
+ "href" : "https://gitlab.example.com/renku-test/test-2022-11-11-17-01-46.git" ,
293
+ "scheme" : "https" ,
294
+ "hostname" : "gitlab.example.com" ,
295
+ "name" : "test-2022-11-11-17-01-46" ,
296
+ "path" : "renku-test/test-2022-11-11-17-01-46.git" ,
297
+ "owner" : "renku-test" ,
298
+ "env" : "https://gitlab.example.com" ,
299
+ },
290
300
],
291
301
)
292
302
def test_valid_href (fields ):
@@ -296,4 +306,8 @@ def test_valid_href(fields):
296
306
if gitlab_env :
297
307
os .environ ["GITLAB_BASE_URL" ] = gitlab_env
298
308
309
+ start = time .monotonic ()
299
310
assert GitURL (** fields ) == GitURL .parse (fields ["href" ])
311
+ duration = time .monotonic () - start
312
+
313
+ assert duration < 1.0 , "Something wrong with the GitUrl regexes, probably catastrophic backtracking"
You can’t perform that action at this time.
0 commit comments