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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder committed
Jul 30, 2010 at 13:31 UTC
60f20d4bb4f56ae90967d810ffb042e9f76b310d
1 file changed
+2
-1
t/t4111-apply-subdir.sh
+2
-1
@@ -36,7 +36,8 @@ test_expect_success 'setup: subdir' '
36
cp "$2" file &&
37
cp "$2" sub/dir/file &&
38
cp "$2" sub/dir/b/file &&
39
- cp "$2" objects/file
39
+ cp "$2" objects/file &&
40
+ test_might_fail git update-index --refresh -q
41
}
42
'
43