Merge branch 'es/rebase-i-respect-core-commentchar'
[gitweb.git] / t / t0008-ignores.sh
index fbf12ae4e2fc3f8e864af0dcdc026ac82782f11f..96f40fedfb7285b50243a1c1bbe64649ef7f8edb 100755 (executable)
@@ -432,7 +432,7 @@ test_expect_success_multi SYMLINKS 'symlink' '::    a/symlink' '
 
 test_expect_success_multi SYMLINKS 'beyond a symlink' '' '
        test_check_ignore "a/symlink/foo" 128 &&
-       test_stderr "fatal: '\''a/symlink/foo'\'' is beyond a symbolic link"
+       test_stderr "fatal: pathspec '\''a/symlink/foo'\'' is beyond a symbolic link"
 '
 
 test_expect_success_multi SYMLINKS 'beyond a symlink from subdirectory' '' '
@@ -440,7 +440,7 @@ test_expect_success_multi SYMLINKS 'beyond a symlink from subdirectory' '' '
                cd a &&
                test_check_ignore "symlink/foo" 128
        ) &&
-       test_stderr "fatal: '\''symlink/foo'\'' is beyond a symbolic link"
+       test_stderr "fatal: pathspec '\''symlink/foo'\'' is beyond a symbolic link"
 '
 
 ############################################################################
@@ -449,7 +449,7 @@ test_expect_success_multi SYMLINKS 'beyond a symlink from subdirectory' '' '
 
 test_expect_success_multi 'submodule' '' '
        test_check_ignore "a/submodule/one" 128 &&
-       test_stderr "fatal: Path '\''a/submodule/one'\'' is in submodule '\''a/submodule'\''"
+       test_stderr "fatal: Pathspec '\''a/submodule/one'\'' is in submodule '\''a/submodule'\''"
 '
 
 test_expect_success_multi 'submodule from subdirectory' '' '
@@ -457,7 +457,7 @@ test_expect_success_multi 'submodule from subdirectory' '' '
                cd a &&
                test_check_ignore "submodule/one" 128
        ) &&
-       test_stderr "fatal: Path '\''a/submodule/one'\'' is in submodule '\''a/submodule'\''"
+       test_stderr "fatal: Pathspec '\''submodule/one'\'' is in submodule '\''a/submodule'\''"
 '
 
 ############################################################################
@@ -688,27 +688,31 @@ do
        '
 done
 
-test_expect_success 'setup: have stdbuf?' '
-       if which stdbuf >/dev/null 2>&1
-       then
-               test_set_prereq STDBUF
-       fi
-'
-
-test_expect_success STDBUF 'streaming support for --stdin' '
-       (
-               echo one
-               sleep 2
-               echo two
-       ) | stdbuf -oL git check-ignore -v -n --stdin >out &
-       pid=$! &&
-       sleep 1 &&
-       grep "^\.gitignore:1:one        one" out &&
-       test $( wc -l <out ) = 1 &&
-       sleep 2 &&
-       grep "^::       two" out &&
-       test $( wc -l <out ) = 2 &&
-       ( wait $pid || kill $pid || : ) 2>/dev/null
+test_expect_success PIPE 'streaming support for --stdin' '
+       mkfifo in out &&
+       (git check-ignore -n -v --stdin <in >out &) &&
+
+       # We cannot just "echo >in" because check-ignore would get EOF
+       # after echo exited; instead we open the descriptor in our
+       # shell, and then echo to the fd. We make sure to close it at
+       # the end, so that the subprocess does get EOF and dies
+       # properly.
+       #
+       # Similarly, we must keep "out" open so that check-ignore does
+       # not ever get SIGPIPE trying to write to us. Not only would that
+       # produce incorrect results, but then there would be no writer on the
+       # other end of the pipe, and we would potentially block forever trying
+       # to open it.
+       exec 9>in &&
+       exec 8<out &&
+       test_when_finished "exec 9>&-" &&
+       test_when_finished "exec 8<&-" &&
+       echo >&9 one &&
+       read response <&8 &&
+       echo "$response" | grep "^\.gitignore:1:one     one" &&
+       echo >&9 two &&
+       read response <&8 &&
+       echo "$response" | grep "^::    two"
 '
 
 test_done