Skip to content

Commit fdf4f6c

Browse files
j6tgitster
authored andcommitted
t6026: clarify the point of "kill $(cat sleep.pid)"
We lengthened the time the leftover process sleeps in the previous commit to make sure it will be there while 'git merge' runs and finishes. It therefore needs to be killed before leaving the test. And it needs to be killed even when 'git merge' fails, so it has to be triggered via test_when_finished mechanism. Explain all that in a large comment, and move the use site of test_when_finished to immediately before 'git merge' invocation, where the process is spawned. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a7d6bcc commit fdf4f6c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

t/t6026-merge-attr.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,20 @@ test_expect_success 'custom merge does not lock index' '
187187
sleep 3600 &
188188
echo $! >sleep.pid
189189
EOF
190-
test_when_finished "kill \$(cat sleep.pid)" &&
191190
192191
test_write_lines >.gitattributes \
193192
"* merge=ours" "text merge=sleep-an-hour" &&
194193
test_config merge.ours.driver true &&
195194
test_config merge.sleep-an-hour.driver ./sleep-an-hour.sh &&
195+
196+
# We are testing that the custom merge driver does not block
197+
# index.lock on Windows due to an inherited file handle.
198+
# To ensure that the backgrounded process ran sufficiently
199+
# long (and has been started in the first place), we do not
200+
# ignore the result of the kill command.
201+
# By packaging the command in test_when_finished, we get both
202+
# the correctness check and the clean-up.
203+
test_when_finished "kill \$(cat sleep.pid)" &&
196204
git merge master
197205
'
198206

0 commit comments

Comments
 (0)