Closed
Description
While the function works well, the regex pattern could be more restrictive to better match Git's reference naming rules:
References cannot begin with a dot or dash
References cannot contain consecutive dots
- if not re.match(r'^[a-zA-Z0-9_\-./]+$', ref):
+ if not re.match(r'^[a-zA-Z0-9][a-zA-Z0-9_\-./]*$', ref) or '..' in ref:
raise ValueError(f"Invalid Git reference: {ref}")
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Archive Backlog