fast-import: forbid escaped NUL in paths

NUL cannot appear in paths. Even disregarding filesystem path
limitations, the tree object format delimits with NUL, so such a path
cannot be encoded by Git.

When a quoted path is unquoted, it could possibly contain NUL from
"\000". Forbid it so it isn't truncated.

fast-import still has other issues with NUL, but those will be addressed
later.

Signed-off-by: Thalia Archibald <thalia@archibald.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Thalia Archibald
2024-04-14 01:12:19 +00:00
committed by Junio C Hamano
parent a923a04b80
commit be4d6a371e
3 changed files with 4 additions and 0 deletions

View File

@ -661,6 +661,7 @@ and its value must be in canonical form. That is it must not:
The root of the tree can be represented by an empty string as `<path>`.
`<path>` cannot contain NUL, either literally or escaped as `\000`.
It is recommended that `<path>` always be encoded using UTF-8.
`filedelete`