summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2016-11-11 21:24:44 +0100
committerJunio C Hamano <gitster@pobox.com>2016-11-11 12:53:21 -0800
commitfdf4f6c79b4260e98729ebeb208036765595e9ac (patch)
tree3be3bb1252c1cac9e43e6efe60130af7ceafc860
parenta7d6bcc32936f3f0c4ba56b5f509648ffa85f63c (diff)
downloadgit-as/merge-attr-sleep.tar.gz
t6026: clarify the point of "kill $(cat sleep.pid)"as/merge-attr-sleep
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 <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t6026-merge-attr.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh
index 348d78b205..8f9b48a493 100755
--- a/t/t6026-merge-attr.sh
+++ b/t/t6026-merge-attr.sh
@@ -187,12 +187,20 @@ test_expect_success 'custom merge does not lock index' '
sleep 3600 &
echo $! >sleep.pid
EOF
- test_when_finished "kill \$(cat sleep.pid)" &&
test_write_lines >.gitattributes \
"* merge=ours" "text merge=sleep-an-hour" &&
test_config merge.ours.driver true &&
test_config merge.sleep-an-hour.driver ./sleep-an-hour.sh &&
+
+ # We are testing that the custom merge driver does not block
+ # index.lock on Windows due to an inherited file handle.
+ # To ensure that the backgrounded process ran sufficiently
+ # long (and has been started in the first place), we do not
+ # ignore the result of the kill command.
+ # By packaging the command in test_when_finished, we get both
+ # the correctness check and the clean-up.
+ test_when_finished "kill \$(cat sleep.pid)" &&
git merge master
'