git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] builtin-apply.c: Skip filenames without enough components

From
Nanako Shiraishi <nanako3@lavabit.com>
Date
Jan 18, 2010, 10:22 UTC
Message-ID
<20100118192235.6117@nanako3.lavabit.com>
In-Reply-To
<201001170344.34525.agruen@suse.de>
Quoting Andreas Gruenbacher <agruen@suse.de>
> On Sunday 17 January 2010 03:22:10 am Junio C Hamano wrote:
>> Tests?
>
> Sure if you think it's worth a regression test ...
Of course you must have a test when you are fixing things. Tests aren't to prove that your patch is correct. They are to prevent other people from breaking your change long after you leave the project.
> Sure if you think it's worth a regression test ... "git apply -p2" of the 
> following patch fails...
You do so by sending a patch to add your new test in t/; adding to an existing related test is preferred if the test is small.
Junio, in case you don't want to wait for Andreas, you can squash this test in.
diff --git a/t/t4120-apply-popt.sh b/t/t4120-apply-popt.sh
index 83d4ba6..b463b4f 100755
--- a/t/t4120-apply-popt.sh
+++ b/t/t4120-apply-popt.sh
@@ -22,4 +22,9 @@ test_expect_success 'apply git diff with -p2' '
 	git apply -p2 patch.file
 '
 
+test_expect_success 'apply with too large -p' '
+	test_must_fail git apply --stat -p3 patch.file 2>err &&
+	grep "removing 3 leading" err
+'
+
 test_done
-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
Previous: Andreas GruenbacherNext: Andreas Gruenbacher
Message 4 of 5 in “builtin-apply.c: Skip filenames without enough components”
  1. builtin-apply.c: Skip filenames without enough componentsAndreas Gruenbacher, Jan 17, 2010
  2. Junio C HamanoJan 17, 2010
  3. Andreas GruenbacherJan 17, 2010
  4. Nanako ShiraishiJan 18, 2010
  5. Andreas GruenbacherJan 18, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.