Merge branch 'rs/sort-oid-array-thread-safe'
[gitweb.git] / t / t6026-merge-attr.sh
index 04c0509c476de87bfb679f1c50556ca4c3a3d615..8f9b48a4937bb4141d17b7d9096d2b6fb695c25c 100755 (executable)
@@ -176,8 +176,32 @@ test_expect_success 'up-to-date merge without common ancestor' '
        test_tick &&
        (
                cd repo1 &&
-               git pull ../repo2 master
+               git fetch ../repo2 master &&
+               git merge --allow-unrelated-histories FETCH_HEAD
        )
 '
 
+test_expect_success 'custom merge does not lock index' '
+       git reset --hard anchor &&
+       write_script sleep-an-hour.sh <<-\EOF &&
+               sleep 3600 &
+               echo $! >sleep.pid
+       EOF
+
+       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
+'
+
 test_done