From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759503AbbA3UcL (ORCPT ); Fri, 30 Jan 2015 15:32:11 -0500 Received: from pb-smtp1.int.icgroup.com ([208.72.237.35]:59614 "EHLO sasl.smtp.pobox.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753005AbbA3UcJ (ORCPT ); Fri, 30 Jan 2015 15:32:09 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=cQ2DEhILWTx/CgWqQx52GI93hmIFUcOL RNSwsikFfw5zSJjf4TjAx9dkUZvqCHI5tGq8TKpdV4AbI40lbqyTbraE4c67NN5y mdS+vZXvKJ0/am5K5zBTQuvbWdBjFHjHRKUhby32uT3BpobWvjItTmcEZnETXQ9x 7DZZYTn2kuU= From: Junio C Hamano To: Jeff King Cc: Git Mailing List , Josh Boyer , "Linux-Kernel\@Vger. Kernel. Org" , twaugh@redhat.com, Linus Torvalds Subject: Re: [PATCH] apply: refuse touching a file beyond symlink References: <20150130181153.GA25513@peff.net> <20150130200731.GC30738@peff.net> Date: Fri, 30 Jan 2015 12:32:07 -0800 In-Reply-To: <20150130200731.GC30738@peff.net> (Jeff King's message of "Fri, 30 Jan 2015 15:07:32 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 0FC1089C-A8BF-11E4-988F-7BA29F42C9D4-77302942!pb-smtp1.pobox.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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