From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E05629AB07 for ; Mon, 7 Jul 2025 12:15:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751890558; cv=none; b=ecLNlIEavGo33DthNkIn69mnm6IBfo7k2rUtbueOyvHmn+dZOLAUZvWImCYs8zzi47e3ElmbDcq3fMOA2cshdGDadDw5ZgieURZ1Au2+qYbTYvfZwHdLWMZZX5SXFZ0OSkdw/1VyLmjkv0vpEcfBfT8RKEy6Iado7laDNLciY/8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751890558; c=relaxed/simple; bh=PZ3cZTJVwk7Z+mxP0289X2eN8/gi3YBi1ObZQaDdasU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fobfwzi4rLaFL2W9Bm7u3iwNnGZBrUFtM4Gfh/0kLh0AX8fWHcxSmk41B9u1EKOsuZdB/hk+6JbKYxtfP2NntQPSBAKqFwDYmtHxTc/xyt8VR7b5j/AsxJeiz/7L/F9GYWqqHzTUSKlZZTHeKxSIxRzYtAAVpwaD6mwpt4bS/XI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ameretat.dev; spf=pass smtp.mailfrom=ameretat.dev; dkim=pass (1024-bit key) header.d=ameretat.dev header.i=@ameretat.dev header.b=Z3dK5QSj; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ameretat.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ameretat.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ameretat.dev header.i=@ameretat.dev header.b="Z3dK5QSj" 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=1751890553; 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=+jLfUHJ22qkGd0N3E56vUIB11ZaeKIXBNpobyam3d6E=; b=Z3dK5QSjgUzA7koxEZgu+Plr2bWpjWFIYslVblqXTpqQuI9RGEJVocL3D2ZPKhbUnQYjCz moSIwbyjUmGCglQpT3ZMFQxUeT/XSU3+YWUt5CGJ6nTMsKioHmXDAc6DDJQsYEjBm9tpKh +K2EQayDpga5UK9tJHUKy8VJ/gd2dw0= From: "Raymond E. Pasco" To: ray@ameretat.dev Cc: aclopte@gmail.com, git@vger.kernel.org, gitster@pobox.com, jason11choca@proton.me, kristofferhaugsbakk@fastmail.com, rhodges@cisco.com Subject: [PATCH v3 3/4] t4140: test apply --intent-to-add interactions Date: Mon, 7 Jul 2025 08:12:32 -0400 Message-ID: <20250707121534.2933349-4-ray@ameretat.dev> In-Reply-To: <20250707121534.2933349-1-ray@ameretat.dev> References: <20250702212814.1923253-1-ray@ameretat.dev> <20250707121534.2933349-1-ray@ameretat.dev> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Test that applying a new file creation patch with --intent-to-add to an existing index does not modify the index outside adding the correct intents-to-add, and that applying a patch with both modifications and new file creations with --intent-to-add correctly only adds intents-to-add to the index. Signed-off-by: Raymond E. Pasco --- t/t4140-apply-ita.sh | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/t/t4140-apply-ita.sh b/t/t4140-apply-ita.sh index c614eaf04c..0b11a8aef4 100755 --- a/t/t4140-apply-ita.sh +++ b/t/t4140-apply-ita.sh @@ -7,6 +7,10 @@ test_description='git apply of i-t-a file' test_expect_success setup ' test_write_lines 1 2 3 4 5 >blueprint && + cat blueprint >committed-file && + git add committed-file && + git commit -m "commit" && + cat blueprint >test-file && git add -N test-file && git diff >creation-patch && @@ -14,7 +18,14 @@ 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 && + test_write_lines 6 >>committed-file && + cat blueprint >test-file && + git add -N test-file && + git diff >complex-patch && + git restore committed-file ' test_expect_success 'apply creation patch to ita path (--cached)' ' @@ -53,4 +64,22 @@ test_expect_success 'apply deletion patch to ita path (--index)' ' git ls-files --stage --error-unmatch test-file ' +test_expect_success 'apply creation patch to existing index with -N' ' + git rm -f test-file && + cat blueprint >index-file && + git add index-file && + git apply -N creation-patch && + + git ls-files --stage --error-unmatch index-file && + git ls-files --stage --error-unmatch test-file +' + +test_expect_success 'apply complex patch with -N' ' + git rm -f test-file index-file && + git apply -N complex-patch && + + git ls-files --stage --error-unmatch test-file && + git diff | grep "a/committed-file" +' + test_done -- 2.50.0.229.gc167f4d905