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

Re: t4111 fails under valgrind

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 30, 2010, 18:31 UTC
Message-ID
<20100730183122.GA7578@dert.cs.uchicago.edu>
In-Reply-To
<201007301218.52437.trast@student.ethz.ch>
Thomas Rast wrote:
>   error: sub/dir/file: does not match index
>   error: sub/dir/file: does not match index
>   error: sub/dir/file: does not match index
>   not ok - 5 apply --index from subdir of toplevel
Thanks for reporting.  Does this patch work for you?
-- 8< --
Subject: t4111 (apply): refresh index before applying patches to it

"git apply", like most plumbing, does not automatically refresh the index file even if it is only stat-dirty. So unless the two "cp" commands in reset_preimage() for a given file happen to have the same time stamp, there will be a spurious

	error: sub/dir/file: does not match index

Refresh the index to eliminate this timing dependency. Noticed by running the test with --valgrind (which slows things down a lot).

Reported-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
diff --git a/t/t4111-apply-subdir.sh b/t/t4111-apply-subdir.sh
index 57cae50..a52d94a 100755
--- a/t/t4111-apply-subdir.sh
+++ b/t/t4111-apply-subdir.sh
@@ -36,7 +36,8 @@ test_expect_success 'setup: subdir' '
 		cp "$2" file &&
 		cp "$2" sub/dir/file &&
 		cp "$2" sub/dir/b/file &&
-		cp "$2" objects/file
+		cp "$2" objects/file &&
+		test_might_fail git update-index --refresh -q
 	}
 '
 
Previous: Thomas RastNext: Thomas Rast
Message 2 of 4 in “t4111 fails under valgrind”
  1. Thomas RastJul 30, 2010
  2. Jonathan NiederJul 30, 2010
  3. Thomas RastJul 30, 2010
  4. Thomas RastAug 4, 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.