3 test_description
=check-ignore
5 TEST_PASSES_SANITIZE_LEAK
=true
6 TEST_CREATE_REPO_NO_TEMPLATE
=1
10 global_excludes
="global-excludes"
13 enable_global_excludes
() {
15 git config core.excludesfile
"$global_excludes"
19 dest
="$HOME/expected-$1" text
="$2"
22 >"$dest" # avoid newline
32 expect_from_stdin
() {
33 cat >"$HOME/expected-stdout"
38 expect_in stderr
"$1" &&
39 test_cmp
"$HOME/expected-stderr" "$HOME/stderr"
43 "$PERL_PATH" -pe 's/^"//; s/\\//; s/"$//; tr/\n/\0/' "$@"
46 broken_c_unquote_verbose
() {
47 "$PERL_PATH" -pe 's/ "/ /; s/\\//; s/"$//; tr/:\t\n/\0/' "$@"
52 if test_i18ngrep
"$regexp" "$HOME/stderr"
56 echo "didn't find /$regexp/ in $HOME/stderr"
62 stderr_empty_on_success
() {
64 if test $expect_code = 0
68 # If we expect failure then stderr might or might not be empty
69 # due to --quiet - the caller can check its contents
74 test_check_ignore
() {
75 args
="$1" expect_code
="${2:-0}" global_args
="$3"
78 rm -f "$HOME/stdout" "$HOME/stderr" "$HOME/cmd" &&
79 echo git
$global_args check-ignore
$quiet_opt $verbose_opt $non_matching_opt $no_index_opt $args \
81 echo "$expect_code" >"$HOME/expected-exit-code" &&
82 test_expect_code
"$expect_code" \
83 git
$global_args check-ignore
$quiet_opt $verbose_opt $non_matching_opt $no_index_opt $args \
84 >"$HOME/stdout" 2>"$HOME/stderr" &&
85 test_cmp
"$HOME/expected-stdout" "$HOME/stdout" &&
86 stderr_empty_on_success
"$expect_code"
89 # Runs the same code with 4 different levels of output verbosity:
91 # 1. with -q / --quiet
92 # 2. with default verbosity
93 # 3. with -v / --verbose
94 # 4. with -v / --verbose, *and* -n / --non-matching
96 # expecting success each time. Takes advantage of the fact that
97 # check-ignore --verbose output is the same as normal output except
98 # for the extra first column.
100 # A parameter is used to determine if the tests are run with the
101 # normal case (using the index), or with the --no-index option.
104 # - (optional) prereqs for this test, e.g. 'SYMLINKS'
106 # - output to expect from the fourth verbosity mode (the output
107 # from the other verbosity modes is automatically inferred
109 # - code to run (should invoke test_check_ignore)
110 # - index option: --index or --no-index
111 test_expect_success_multiple
() {
118 if test "$4" = "--index"
124 testname
="$1" expect_all
="$2" code
="$3"
126 expect_verbose
=$
( echo "$expect_all" |
grep -v '^:: ' )
127 expect
=$
( echo "$expect_verbose" |
sed -e 's/.* //' )
129 test_expect_success
$prereq "$testname${no_index_opt:+ with $no_index_opt}" '
134 # --quiet is only valid when a single pattern is passed
135 if test $
( echo "$expect_all" |
wc -l ) = 1
137 for quiet_opt
in '-q' '--quiet'
139 opts
="${no_index_opt:+$no_index_opt }$quiet_opt"
140 test_expect_success
$prereq "$testname${opts:+ with $opts}" "
148 for verbose_opt
in '-v' '--verbose'
150 for non_matching_opt
in '' '-n' '--non-matching'
152 if test -n "$non_matching_opt"
154 my_expect
="$expect_all"
156 my_expect
="$expect_verbose"
160 expect '$my_expect' &&
163 opts
="${no_index_opt:+$no_index_opt }$verbose_opt${non_matching_opt:+ $non_matching_opt}"
164 test_expect_success
$prereq "$testname${opts:+ with $opts}" "$test_code"
172 test_expect_success_multi
() {
173 test_expect_success_multiple
"$@" "--index"
176 test_expect_success_no_index_multi
() {
177 test_expect_success_multiple
"$@" "--no-index"
180 test_expect_success
'setup' '
182 mkdir -p a/b/ignored-dir a/submodule b &&
183 if test_have_prereq SYMLINKS
192 git commit -m"commit in submodule"
194 git add a/submodule &&
195 cat <<-\EOF >.gitignore &&
202 : >$dir/not-ignored &&
203 : >$dir/ignored-and-untracked &&
204 : >$dir/ignored-but-in-index || return 1
206 git add -f ignored-but-in-index a/ignored-but-in-index &&
207 cat <<-\EOF >a/.gitignore &&
211 cat <<-\EOF >a/b/.gitignore &&
214 # this comment should affect the line numbers
217 # and so should this blank line:
222 echo "seven" >a/b/ignored-dir/.gitignore &&
224 cat <<-\EOF >"$global_excludes" &&
230 cat <<-\EOF >.git/info/exclude
235 ############################################################################
237 # test invalid inputs
239 test_expect_success_multi
'. corner-case' ':: .' '
240 test_check_ignore . 1
243 test_expect_success_multi
'empty command line' '' '
244 test_check_ignore "" 128 &&
245 stderr_contains "fatal: no path specified"
248 test_expect_success_multi
'--stdin with empty STDIN' '' '
249 test_check_ignore "--stdin" 1 </dev/null &&
253 test_expect_success
'-q with multiple args' '
255 test_check_ignore "-q one two" 128 &&
256 stderr_contains "fatal: --quiet is only valid with a single pathname"
259 test_expect_success
'--quiet with multiple args' '
261 test_check_ignore "--quiet one two" 128 &&
262 stderr_contains "fatal: --quiet is only valid with a single pathname"
265 for verbose_opt
in '-v' '--verbose'
267 for quiet_opt
in '-q' '--quiet'
269 test_expect_success
"$quiet_opt $verbose_opt" "
271 test_check_ignore '$quiet_opt $verbose_opt foo' 128 &&
272 stderr_contains 'fatal: cannot have both --quiet and --verbose'
277 test_expect_success
'--quiet with multiple args' '
279 test_check_ignore "--quiet one two" 128 &&
280 stderr_contains "fatal: --quiet is only valid with a single pathname"
283 test_expect_success_multi
'erroneous use of --' '' '
284 test_check_ignore "--" 128 &&
285 stderr_contains "fatal: no path specified"
288 test_expect_success_multi
'--stdin with superfluous arg' '' '
289 test_check_ignore "--stdin foo" 128 &&
290 stderr_contains "fatal: cannot specify pathnames with --stdin"
293 test_expect_success_multi
'--stdin -z with superfluous arg' '' '
294 test_check_ignore "--stdin -z foo" 128 &&
295 stderr_contains "fatal: cannot specify pathnames with --stdin"
298 test_expect_success_multi
'-z without --stdin' '' '
299 test_check_ignore "-z" 128 &&
300 stderr_contains "fatal: -z only makes sense with --stdin"
303 test_expect_success_multi
'-z without --stdin and superfluous arg' '' '
304 test_check_ignore "-z foo" 128 &&
305 stderr_contains "fatal: -z only makes sense with --stdin"
308 test_expect_success_multi
'needs work tree' '' '
311 test_check_ignore "foo" 128
313 stderr_contains "fatal: this operation must be run in a work tree"
316 ############################################################################
318 # test standard ignores
320 # First make sure that the presence of a file in the working tree
321 # does not impact results, but that the presence of a file in the
322 # index does unless the --no-index option is used.
324 for subdir
in '' 'a/'
330 where
="in subdir $subdir"
333 test_expect_success_multi
"non-existent file $where not ignored" \
334 ":: ${subdir}non-existent" \
335 "test_check_ignore '${subdir}non-existent' 1"
337 test_expect_success_no_index_multi
"non-existent file $where not ignored" \
338 ":: ${subdir}non-existent" \
339 "test_check_ignore '${subdir}non-existent' 1"
341 test_expect_success_multi
"non-existent file $where ignored" \
342 ".gitignore:1:one ${subdir}one" \
343 "test_check_ignore '${subdir}one'"
345 test_expect_success_no_index_multi
"non-existent file $where ignored" \
346 ".gitignore:1:one ${subdir}one" \
347 "test_check_ignore '${subdir}one'"
349 test_expect_success_multi
"existing untracked file $where not ignored" \
350 ":: ${subdir}not-ignored" \
351 "test_check_ignore '${subdir}not-ignored' 1"
353 test_expect_success_no_index_multi
"existing untracked file $where not ignored" \
354 ":: ${subdir}not-ignored" \
355 "test_check_ignore '${subdir}not-ignored' 1"
357 test_expect_success_multi
"existing tracked file $where not ignored" \
358 ":: ${subdir}ignored-but-in-index" \
359 "test_check_ignore '${subdir}ignored-but-in-index' 1"
361 test_expect_success_no_index_multi
"existing tracked file $where shown as ignored" \
362 ".gitignore:2:ignored-* ${subdir}ignored-but-in-index" \
363 "test_check_ignore '${subdir}ignored-but-in-index'"
365 test_expect_success_multi
"existing untracked file $where ignored" \
366 ".gitignore:2:ignored-* ${subdir}ignored-and-untracked" \
367 "test_check_ignore '${subdir}ignored-and-untracked'"
369 test_expect_success_no_index_multi
"existing untracked file $where ignored" \
370 ".gitignore:2:ignored-* ${subdir}ignored-and-untracked" \
371 "test_check_ignore '${subdir}ignored-and-untracked'"
373 test_expect_success_multi
"mix of file types $where" \
374 ":: ${subdir}non-existent
375 .gitignore:1:one ${subdir}one
376 :: ${subdir}not-ignored
377 :: ${subdir}ignored-but-in-index
378 .gitignore:2:ignored-* ${subdir}ignored-and-untracked" \
380 ${subdir}non-existent
383 ${subdir}ignored-but-in-index
384 ${subdir}ignored-and-untracked'
387 test_expect_success_no_index_multi
"mix of file types $where" \
388 ":: ${subdir}non-existent
389 .gitignore:1:one ${subdir}one
390 :: ${subdir}not-ignored
391 .gitignore:2:ignored-* ${subdir}ignored-but-in-index
392 .gitignore:2:ignored-* ${subdir}ignored-and-untracked" \
394 ${subdir}non-existent
397 ${subdir}ignored-but-in-index
398 ${subdir}ignored-and-untracked'
402 # Having established the above, from now on we mostly test against
403 # files which do not exist in the working tree or index.
405 test_expect_success
'sub-directory local ignore' '
406 expect "a/3-three" &&
407 test_check_ignore "a/3-three a/three-not-this-one"
410 test_expect_success
'sub-directory local ignore with --verbose' '
411 expect "a/.gitignore:2:*three a/3-three" &&
412 test_check_ignore "--verbose a/3-three a/three-not-this-one"
415 test_expect_success
'local ignore inside a sub-directory' '
419 test_check_ignore "3-three three-not-this-one"
422 test_expect_success
'local ignore inside a sub-directory with --verbose' '
423 expect "a/.gitignore:2:*three 3-three" &&
426 test_check_ignore "--verbose 3-three three-not-this-one"
430 test_expect_success
'nested include of negated pattern' '
432 test_check_ignore "a/b/one" 1
435 test_expect_success
'nested include of negated pattern with -q' '
437 test_check_ignore "-q a/b/one" 1
440 test_expect_success
'nested include of negated pattern with -v' '
441 expect "a/b/.gitignore:8:!on* a/b/one" &&
442 test_check_ignore "-v a/b/one" 0
445 test_expect_success
'nested include of negated pattern with -v -n' '
446 expect "a/b/.gitignore:8:!on* a/b/one" &&
447 test_check_ignore "-v -n a/b/one" 0
450 ############################################################################
452 # test ignored sub-directories
454 test_expect_success_multi
'ignored sub-directory' \
455 'a/b/.gitignore:5:ignored-dir/ a/b/ignored-dir' '
456 test_check_ignore "a/b/ignored-dir"
459 test_expect_success
'multiple files inside ignored sub-directory' '
460 expect_from_stdin <<-\EOF &&
462 a/b/ignored-dir/twoooo
463 a/b/ignored-dir/seven
465 test_check_ignore "a/b/ignored-dir/foo a/b/ignored-dir/twoooo a/b/ignored-dir/seven"
468 test_expect_success
'multiple files inside ignored sub-directory with -v' '
469 expect_from_stdin <<-\EOF &&
470 a/b/.gitignore:5:ignored-dir/ a/b/ignored-dir/foo
471 a/b/.gitignore:5:ignored-dir/ a/b/ignored-dir/twoooo
472 a/b/.gitignore:5:ignored-dir/ a/b/ignored-dir/seven
474 test_check_ignore "-v a/b/ignored-dir/foo a/b/ignored-dir/twoooo a/b/ignored-dir/seven"
477 test_expect_success
'cd to ignored sub-directory' '
478 expect_from_stdin <<-\EOF &&
485 cd a/b/ignored-dir &&
486 test_check_ignore "foo twoooo ../one seven ../../one"
490 test_expect_success
'cd to ignored sub-directory with -v' '
491 expect_from_stdin <<-\EOF &&
492 a/b/.gitignore:5:ignored-dir/ foo
493 a/b/.gitignore:5:ignored-dir/ twoooo
494 a/b/.gitignore:8:!on* ../one
495 a/b/.gitignore:5:ignored-dir/ seven
496 .gitignore:1:one ../../one
499 cd a/b/ignored-dir &&
500 test_check_ignore "-v foo twoooo ../one seven ../../one"
504 ############################################################################
506 # test handling of symlinks
508 test_expect_success_multi SYMLINKS
'symlink' ':: a/symlink' '
509 test_check_ignore "a/symlink" 1
512 test_expect_success_multi SYMLINKS
'beyond a symlink' '' '
513 test_check_ignore "a/symlink/foo" 128 &&
514 test_stderr "fatal: pathspec '\''a/symlink/foo'\'' is beyond a symbolic link"
517 test_expect_success_multi SYMLINKS
'beyond a symlink from subdirectory' '' '
520 test_check_ignore "symlink/foo" 128
522 test_stderr "fatal: pathspec '\''symlink/foo'\'' is beyond a symbolic link"
525 ############################################################################
527 # test handling of submodules
529 test_expect_success_multi
'submodule' '' '
530 test_check_ignore "a/submodule/one" 128 &&
531 test_stderr "fatal: Pathspec '\''a/submodule/one'\'' is in submodule '\''a/submodule'\''"
534 test_expect_success_multi
'submodule from subdirectory' '' '
537 test_check_ignore "submodule/one" 128
539 test_stderr "fatal: Pathspec '\''submodule/one'\'' is in submodule '\''a/submodule'\''"
542 ############################################################################
544 # test handling of global ignore files
546 test_expect_success
'global ignore not yet enabled' '
547 expect_from_stdin <<-\EOF &&
548 .git/info/exclude:1:per-repo per-repo
549 a/.gitignore:2:*three a/globalthree
550 .git/info/exclude:1:per-repo a/per-repo
552 test_check_ignore "-v globalone per-repo a/globalthree a/per-repo not-ignored a/globaltwo"
555 test_expect_success
'global ignore' '
556 enable_global_excludes &&
557 expect_from_stdin <<-\EOF &&
564 test_check_ignore "globalone per-repo globalthree a/globalthree a/per-repo not-ignored globaltwo"
567 test_expect_success
'global ignore with -v' '
568 enable_global_excludes &&
569 expect_from_stdin <<-EOF &&
570 $global_excludes:1:globalone globalone
571 .git/info/exclude:1:per-repo per-repo
572 $global_excludes:3:globalthree globalthree
573 a/.gitignore:2:*three a/globalthree
574 .git/info/exclude:1:per-repo a/per-repo
575 $global_excludes:2:!globaltwo globaltwo
577 test_check_ignore "-v globalone per-repo globalthree a/globalthree a/per-repo not-ignored globaltwo"
580 ############################################################################
602 cat <<-\
EOF >expected-default
607 cat <<-EOF >expected-verbose
609 .gitignore:1:one a/one
610 a/b/.gitignore:8:!on* a/b/on
611 a/b/.gitignore:8:!on* a/b/one
612 a/b/.gitignore:8:!on* a/b/one one
613 a/b/.gitignore:8:!on* a/b/one two
614 a/b/.gitignore:8:!on* "a/b/one\\"three"
615 a/b/.gitignore:9:!two a/b/two
616 a/.gitignore:1:two* a/b/twooo
617 $global_excludes:2:!globaltwo globaltwo
618 $global_excludes:2:!globaltwo a/globaltwo
619 $global_excludes:2:!globaltwo a/b/globaltwo
620 $global_excludes:2:!globaltwo b/globaltwo
623 broken_c_unquote stdin >stdin0
625 broken_c_unquote expected-default >expected-default0
627 broken_c_unquote_verbose expected-verbose >expected-verbose0
629 test_expect_success '--stdin' '
630 expect_from_stdin <expected-default &&
631 test_check_ignore "--stdin" <stdin
634 test_expect_success '--stdin -q' '
636 test_check_ignore "-q --stdin" <stdin
639 test_expect_success '--stdin -v' '
640 expect_from_stdin <expected-verbose &&
641 test_check_ignore "-v --stdin" <stdin
644 for opts in '--stdin -z' '-z --stdin'
646 test_expect_success "$opts" "
647 expect_from_stdin <expected-default0 &&
648 test_check_ignore '$opts' <stdin0
651 test_expect_success "$opts -q" "
653 test_check_ignore '-q $opts' <stdin0
656 test_expect_success "$opts -v" "
657 expect_from_stdin <expected-verbose0 &&
658 test_check_ignore '-v $opts' <stdin0
681 # N.B. we deliberately end STDIN with a non-matching pattern in order
682 # to test that the exit code indicates that one or more of the
683 # provided paths is ignored - in other words
, that it represents an
684 # aggregation of all the results, not just the final result.
686 cat <<-EOF >expected-all
687 .gitignore:1:one ../one
691 a/b/.gitignore:8:!on* b/on
692 a/b/.gitignore:8:!on* b/one
693 a/b/.gitignore:8:!on* b/one one
694 a/b/.gitignore:8:!on* b/one two
695 a/b/.gitignore:8:!on* "b/one\\"three"
696 a/b/.gitignore:9:!two b/two
698 a/.gitignore:1:two* b/twooo
699 $global_excludes:2:!globaltwo ../globaltwo
700 $global_excludes:2:!globaltwo globaltwo
701 $global_excludes:2:!globaltwo b/globaltwo
702 $global_excludes:2:!globaltwo ../b/globaltwo
705 cat <<-EOF >expected-default
710 grep -v '^:: ' expected-all
>expected-verbose
712 broken_c_unquote stdin
>stdin0
714 broken_c_unquote expected-default
>expected-default0
716 broken_c_unquote_verbose expected-verbose
>expected-verbose0
718 test_expect_success
'--stdin from subdirectory' '
719 expect_from_stdin <expected-default &&
722 test_check_ignore "--stdin" <../stdin
726 test_expect_success
'--stdin from subdirectory with -v' '
727 expect_from_stdin <expected-verbose &&
730 test_check_ignore "--stdin -v" <../stdin
734 test_expect_success
'--stdin from subdirectory with -v -n' '
735 expect_from_stdin <expected-all &&
738 test_check_ignore "--stdin -v -n" <../stdin
742 for opts
in '--stdin -z' '-z --stdin'
744 test_expect_success
"$opts from subdirectory" '
745 expect_from_stdin <expected-default0 &&
748 test_check_ignore "'"$opts"'" <../stdin0
752 test_expect_success
"$opts from subdirectory with -v" '
753 expect_from_stdin <expected-verbose0 &&
756 test_check_ignore "'"$opts"' -v" <../stdin0
761 test_expect_success PIPE
'streaming support for --stdin' '
763 (git check-ignore -n -v --stdin <in >out &) &&
765 # We cannot just "echo >in" because check-ignore would get EOF
766 # after echo exited; instead we open the descriptor in our
767 # shell, and then echo to the fd. We make sure to close it at
768 # the end, so that the subprocess does get EOF and dies
771 # Similarly, we must keep "out" open so that check-ignore does
772 # not ever get SIGPIPE trying to write to us. Not only would that
773 # produce incorrect results, but then there would be no writer on the
774 # other end of the pipe, and we would potentially block forever trying
778 test_when_finished "exec 9>&-" &&
779 test_when_finished "exec 8<&-" &&
782 echo "$response" | grep "^\.gitignore:1:one one" &&
785 echo "$response" | grep "^:: two"
788 test_expect_success
'existing file and directory' '
789 test_when_finished "rm one" &&
790 test_when_finished "rmdir top-level-dir" &&
792 mkdir top-level-dir &&
793 git check-ignore one top-level-dir >actual &&
795 grep top-level-dir actual
798 test_expect_success
'existing directory and file' '
799 test_when_finished "rm one" &&
800 test_when_finished "rmdir top-level-dir" &&
802 mkdir top-level-dir &&
803 git check-ignore top-level-dir one >actual &&
805 grep top-level-dir actual
808 test_expect_success
'exact prefix matching (with root)' '
809 test_when_finished rm -r a &&
810 mkdir -p a/git a/git-foo &&
811 touch a/git/foo a/git-foo/bar &&
812 echo /git/ >a/.gitignore &&
813 git check-ignore a/git a/git/foo a/git-foo a/git-foo/bar >actual &&
814 cat >expect <<-\EOF &&
818 test_cmp expect actual
821 test_expect_success
'exact prefix matching (without root)' '
822 test_when_finished rm -r a &&
823 mkdir -p a/git a/git-foo &&
824 touch a/git/foo a/git-foo/bar &&
825 echo git/ >a/.gitignore &&
826 git check-ignore a/git a/git/foo a/git-foo a/git-foo/bar >actual &&
827 cat >expect <<-\EOF &&
831 test_cmp expect actual
834 test_expect_success
'directories and ** matches' '
835 cat >.gitignore <<-\EOF &&
840 git check-ignore file \
841 data/file data/data1/file1 data/data1/file1.txt \
842 data/data2/file2 data/data2/file2.txt >actual &&
843 cat >expect <<-\EOF &&
848 test_cmp expect actual
851 ############################################################################
853 # test whitespace handling
855 test_expect_success
'trailing whitespace is ignored' '
857 >whitespace/trailing &&
858 >whitespace/untracked &&
859 echo "whitespace/trailing " >ignore &&
863 git ls-files -o -X ignore whitespace >actual 2>err &&
864 test_cmp expect actual &&
865 test_must_be_empty err
868 test_expect_success
!MINGW
'quoting allows trailing whitespace' '
871 >"whitespace/trailing " &&
872 >whitespace/untracked &&
873 echo "whitespace/trailing\\ \\ " >ignore &&
874 echo whitespace/untracked >expect &&
875 git ls-files -o -X ignore whitespace >actual 2>err &&
876 test_cmp expect actual &&
877 test_must_be_empty err
880 test_expect_success
!MINGW
,!CYGWIN
'correct handling of backslashes' '
883 >"whitespace/trailing 1 " &&
884 >"whitespace/trailing 2 \\\\" &&
885 >"whitespace/trailing 3 \\\\" &&
886 >"whitespace/trailing 4 \\ " &&
887 >"whitespace/trailing 5 \\ \\ " &&
888 >"whitespace/trailing 6 \\a\\" &&
889 >whitespace/untracked &&
890 sed -e "s/Z$//" >ignore <<-\EOF &&
891 whitespace/trailing 1 \ Z
892 whitespace/trailing 2 \\\\Z
893 whitespace/trailing 3 \\\\ Z
894 whitespace/trailing 4 \\\ Z
895 whitespace/trailing 5 \\ \\\ Z
896 whitespace/trailing 6 \\a\\Z
898 echo whitespace/untracked >expect &&
899 git ls-files -o -X ignore whitespace >actual 2>err &&
900 test_cmp expect actual &&
901 test_must_be_empty err
904 test_expect_success
'info/exclude trumps core.excludesfile' '
905 echo >>global-excludes usually-ignored &&
906 echo >>.git/info/exclude "!usually-ignored" &&
908 echo "?? usually-ignored" >expect &&
910 git status --porcelain usually-ignored >actual &&
911 test_cmp expect actual
914 test_expect_success SYMLINKS
'set up ignore file for symlink tests' '
916 rm -f .gitignore .git/info/exclude
919 test_expect_success SYMLINKS
'symlinks respected in core.excludesFile' '
920 test_when_finished "rm symlink" &&
921 ln -s ignore symlink &&
922 test_config core.excludesFile "$(pwd)/symlink" &&
924 git check-ignore file >actual 2>err &&
925 test_cmp expect actual &&
926 test_must_be_empty err
929 test_expect_success SYMLINKS
'symlinks respected in info/exclude' '
930 test_when_finished "rm .git/info/exclude" &&
931 ln -s ../../ignore .git/info/exclude &&
933 git check-ignore file >actual 2>err &&
934 test_cmp expect actual &&
935 test_must_be_empty err
938 test_expect_success SYMLINKS
'symlinks not respected in-tree' '
939 test_when_finished "rm .gitignore" &&
940 ln -s ignore .gitignore &&
942 ln -s ignore subdir/.gitignore &&
943 test_must_fail git check-ignore subdir/file >actual 2>err &&
944 test_must_be_empty actual &&
945 test_i18ngrep "unable to access.*gitignore" err