Skip to content

Commit f5a8ad4

Browse files
committed
Merge branch 'as/merge-attr-sleep'
Fix for a racy false-positive test failure. * as/merge-attr-sleep: t6026: clarify the point of "kill $(cat sleep.pid)" t6026: ensure that long-running script really is Revert "t6026-merge-attr: don't fail if sleep exits early" Revert "t6026-merge-attr: ensure that the merge driver was called" t6026-merge-attr: ensure that the merge driver was called t6026-merge-attr: don't fail if sleep exits early
2 parents 0538b84 + fdf4f6c commit f5a8ad4

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

t/t6026-merge-attr.sh

+13-5
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,24 @@ test_expect_success 'up-to-date merge without common ancestor' '
183183

184184
test_expect_success 'custom merge does not lock index' '
185185
git reset --hard anchor &&
186-
write_script sleep-one-second.sh <<-\EOF &&
187-
sleep 1 &
186+
write_script sleep-an-hour.sh <<-\EOF &&
187+
sleep 3600 &
188188
echo $! >sleep.pid
189189
EOF
190-
test_when_finished "kill \$(cat sleep.pid)" &&
191190
192191
test_write_lines >.gitattributes \
193-
"* merge=ours" "text merge=sleep-one-second" &&
192+
"* merge=ours" "text merge=sleep-an-hour" &&
194193
test_config merge.ours.driver true &&
195-
test_config merge.sleep-one-second.driver ./sleep-one-second.sh &&
194+
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)