From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 1F9641F531 for ; Sat, 8 Aug 2020 07:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726152AbgHHH6u (ORCPT ); Sat, 8 Aug 2020 03:58:50 -0400 Received: from out1.migadu.com ([91.121.223.63]:17710 "EHLO out1.migadu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725853AbgHHH6t (ORCPT ); Sat, 8 Aug 2020 03:58:49 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ameretat.dev; s=default; t=1596873527; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JVWNx3fdBxUBeWUrFIgMhscwelvmKDW5JYcfTvmBoPY=; b=cDMfa3sCDTJVK+K7QsxsbrHSys9nXbPghhs7NXDl8TFc+ZNyBG99UIl61sYQ+N8S3xqm+J ajs16L5X6FM2/dxuP2u42OYQZJZTVCQJxxCCRZJPpBeIV10YXsr0XS00Nz1EdFJsvuleBy PM3L3XrYJN1TOiScFsfHh8VoEg3ZnKo= From: "Raymond E. Pasco" To: Junio C Hamano Cc: git@vger.kernel.org, "Raymond E. Pasco" Subject: [HYPOTHETICAL PATCH 2/2] t4140: test failure of diff from empty blob to i-t-a path Date: Sat, 8 Aug 2020 03:58:27 -0400 Message-Id: <20200808075827.36248-3-ray@ameretat.dev> In-Reply-To: <20200808075827.36248-1-ray@ameretat.dev> References: <20200806060119.74587-1-ray@ameretat.dev> <20200808075827.36248-1-ray@ameretat.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org "git apply" should only accept new file or deleted file patches to an i-t-a index entry. Signed-off-by: Raymond E. Pasco --- t/t4140-apply-ita.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/t/t4140-apply-ita.sh b/t/t4140-apply-ita.sh index c614eaf04c..898dd251b4 100755 --- a/t/t4140-apply-ita.sh +++ b/t/t4140-apply-ita.sh @@ -14,7 +14,13 @@ test_expect_success setup ' rm -f test-file && git diff >deletion-patch && - grep "deleted file mode 100644" deletion-patch + grep "deleted file mode 100644" deletion-patch && + + git rm -f test-file && + touch test-file && + git add test-file && + cat blueprint >test-file && + git diff >incorrect-patch ' test_expect_success 'apply creation patch to ita path (--cached)' ' @@ -27,6 +33,14 @@ test_expect_success 'apply creation patch to ita path (--cached)' ' test_cmp blueprint actual ' +test_expect_success 'apply diff from empty blob to ita path (--cached)' ' + git rm -f test-file && + cat blueprint >test-file && + git add -N test-file && + + test_must_fail git apply --cached incorrect-patch +' + test_expect_success 'apply creation patch to ita path (--index)' ' git rm -f test-file && cat blueprint >test-file && -- 2.28.0.5.gfc8e108108