]> git.ipfire.org Git - thirdparty/git.git/commit
fast-import: disallow "." and ".." path components
authorElijah Newren <newren@gmail.com>
Mon, 25 Nov 2024 19:00:48 +0000 (19:00 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 26 Nov 2024 01:30:04 +0000 (10:30 +0900)
commit4a2790a257b314ab59f6f2e25f3d7ca120219922
tree1853f38fc72b4a75d04ae6cf7ef5d31cf4941da2
parent92999a42db1c5f43f330e4f2bca4026b5b81576f
fast-import: disallow "." and ".." path components

If a user specified e.g.
   M 100644 :1 ../some-file
then fast-import previously would happily create a git history where
there is a tree in the top-level directory named "..", and with a file
inside that directory named "some-file".  The top-level ".." directory
causes problems.  While git checkout will die with errors and fsck will
report hasDotdot problems, the user is going to have problems trying to
remove the problematic file.  Simply avoid creating this bad history in
the first place.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fast-import.c
t/t9300-fast-import.sh