Yes. The index and tree objects both impose limitations due to their design:
A NUL
cannot be in a path name. git uses null terminated strings to store filenames internally, both in the index and in tree objects.
A /
cannot be in a filename, as it is the path separator in the index.
There are additional limitations imposed by Git clients, which are not part of the design of the data file formats:
A path component cannot be named .git
.
A path component may not be named .
or ..
, to prevent you from escaping your working directory.
If core.protectHFS
is set, then when all zero-width Unicode characters are removed from a path component, the remainder may not be .git
.
If core.protectNTFS
is set, then a path component may not be GIT~1
, .git\
or .git
followed by trailing spaces or dots.
And no, you cannot create those with libgit2 either, because it also uses null terminated strings to store paths. It seems unlikely that there's a buffer overrun potential here (if anything, you would expect a buffer underrun).