Regular Expressions 101

Community Patterns

git-http-backend valid paths regex

1

Regular Expression
PCRE2 (PHP >=7.3)

/
\/(HEAD|(info\/refs)|(objects\/info\/(alternates|http-alternates|packs))|(objects\/[0-9a-f]{2}\/[0-9a-f]{38,62})|(objects\/pack\/pack-[0-9a-f]{40,64}\\\\\.(pack|idx))|(git-(upload|receive)-pack))$
/
gm

Description

extracted from actual git-http-backend's source code, so you can use it directly without any worry

https://github.com/git/git/blob/39fe402d6727efb6c98ddca19fae1f094ffaa6b3/http-backend.c#L713-L726C2

Submitted by anonymous - 3 months ago