Skip to content

Commit

Permalink
t4111 (apply): refresh index before applying patches to it
Browse files Browse the repository at this point in the history
"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>
  • Loading branch information
Jonathan Nieder authored and Junio C Hamano committed Aug 4, 2010
1 parent 60c98d1 commit 60f20d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion t/t4111-apply-subdir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
'

Expand Down

0 comments on commit 60f20d4

Please sign in to comment.