From: Junio C Hamano Date: Fri, 30 Jan 2015 20:32:07 GMT Subject: Re: [PATCH] apply: refuse touching a file beyond symlink Message-ID: In-Reply-To: <20150130200731.GC30738@peff.net> Jeff King writes: > Hrm. That only works in the current code because we apply the deletion > in the directory (and then clean up the now-empty directory) first. So I > think you would need to check the paths progressively as you apply them, > since those other parts of the diff "haven't happened yet". Just to make sure that I am not hallucinating, I added this one: diff --git a/t/t4114-apply-typechange.sh b/t/t4114-apply-typechange.sh index ebadbc3..83ddf62 100755 --- a/t/t4114-apply-typechange.sh +++ b/t/t4114-apply-typechange.sh @@ -119,4 +119,12 @@ test_expect_success 'directory becomes symlink' ' test_debug 'cat patch' +test_expect_success 'directory becomes symlink' ' + git checkout -f foo-becomes-a-directory && + printf "%s\n" foo/baz foo >order && + git diff-tree -Oorder -p HEAD foo-symlinked-to-bar >patch && + git apply --index