3 # Copyright (c) 2006 Carl D. Worth
6 test_description
='Test of the various options to git rm.'
8 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=master
9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
13 # Setup some files to be removed, some with funny characters
14 test_expect_success
'Initialize test directory' '
15 touch -- foo bar baz "space embedded" -q &&
16 git add -- foo bar baz "space embedded" -q &&
17 git commit -m "add normal files"
20 if test_have_prereq
!FUNNYNAMES
22 say
'Your filesystem does not allow tabs in filenames.'
25 test_expect_success FUNNYNAMES
'add files with funny names' '
26 touch -- "tab embedded" "newline${LF}embedded" &&
27 git add -- "tab embedded" "newline${LF}embedded" &&
28 git commit -m "add files with tabs and newlines"
31 test_expect_success
'Pre-check that foo exists and is in index before git rm foo' '
32 test_path_is_file foo &&
33 git ls-files --error-unmatch foo
36 test_expect_success
'Test that git rm foo succeeds' '
40 test_expect_success
'Test that git rm --cached foo succeeds if the index matches the file' '
46 test_expect_success
'Test that git rm --cached foo succeeds if the index matches the file' '
50 echo "other content" >foo &&
54 test_expect_success
'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' '
57 git commit -m foo --allow-empty &&
58 echo "other content" >foo &&
60 echo "yet another content" >foo &&
61 test_must_fail git rm --cached foo
64 test_expect_success
'Test that git rm --cached -f foo works in case where --cached only did not' '
67 git commit -m foo --allow-empty &&
68 echo "other content" >foo &&
70 echo "yet another content" >foo &&
71 git rm --cached -f foo
74 test_expect_success
'Post-check that foo exists but is not in index after git rm foo' '
75 test_path_is_file foo &&
76 test_must_fail git ls-files --error-unmatch foo
79 test_expect_success
'Pre-check that bar exists and is in index before "git rm bar"' '
80 test_path_is_file bar &&
81 git ls-files --error-unmatch bar
84 test_expect_success
'Test that "git rm bar" succeeds' '
88 test_expect_success
'Post-check that bar does not exist and is not in index after "git rm -f bar"' '
89 test_path_is_missing bar &&
90 test_must_fail git ls-files --error-unmatch bar
93 test_expect_success
'Test that "git rm -- -q" succeeds (remove a file that looks like an option)' '
97 test_expect_success FUNNYNAMES
'Test that "git rm -f" succeeds with embedded space, tab, or newline characters.' '
98 git rm -f "space embedded" "tab embedded" "newline${LF}embedded"
101 test_expect_success SANITY
'Test that "git rm -f" fails if its rm fails' '
102 test_when_finished "chmod 775 ." &&
104 test_must_fail git rm -f baz
107 test_expect_success
'When the rm in "git rm -f" fails, it should not remove the file from the index' '
108 git ls-files --error-unmatch baz
111 test_expect_success
'Remove nonexistent file with --ignore-unmatch' '
112 git rm --ignore-unmatch nonexistent
115 test_expect_success
'"rm" command printed' '
116 echo frotz >test-file &&
118 git commit -m "add file for rm test" &&
119 git rm test-file >rm-output.raw &&
120 grep "^rm " rm-output.raw >rm-output &&
121 test_line_count = 1 rm-output &&
122 rm -f test-file rm-output.raw rm-output &&
123 git commit -m "remove file from rm test"
126 test_expect_success
'"rm" command suppressed with --quiet' '
127 echo frotz >test-file &&
129 git commit -m "add file for rm --quiet test" &&
130 git rm --quiet test-file >rm-output &&
131 test_must_be_empty rm-output &&
132 rm -f test-file rm-output &&
133 git commit -m "remove file from rm --quiet test"
136 # Now, failure cases.
137 test_expect_success
'Re-add foo and baz' '
139 git ls-files --error-unmatch foo baz
142 test_expect_success
'Modify foo -- rm should refuse' '
144 test_must_fail git rm foo baz &&
145 test_path_is_file foo &&
146 test_path_is_file baz &&
147 git ls-files --error-unmatch foo baz
150 test_expect_success
'Modified foo -- rm -f should work' '
152 test_path_is_missing foo &&
153 test_path_is_missing baz &&
154 test_must_fail git ls-files --error-unmatch foo &&
155 test_must_fail git ls-files --error-unmatch bar
158 test_expect_success
'Re-add foo and baz for HEAD tests' '
160 git checkout HEAD -- baz &&
162 git ls-files --error-unmatch foo baz
165 test_expect_success
'foo is different in index from HEAD -- rm should refuse' '
166 test_must_fail git rm foo baz &&
167 test_path_is_file foo &&
168 test_path_is_file baz &&
169 git ls-files --error-unmatch foo baz
172 test_expect_success
'but with -f it should work.' '
174 test_path_is_missing foo &&
175 test_path_is_missing baz &&
176 test_must_fail git ls-files --error-unmatch foo &&
177 test_must_fail git ls-files --error-unmatch baz
180 test_expect_success
'refuse to remove cached empty file with modifications' '
183 echo content >empty &&
184 test_must_fail git rm --cached empty
187 test_expect_success
'remove intent-to-add file without --force' '
188 echo content >intent-to-add &&
189 git add -N intent-to-add &&
190 git rm --cached intent-to-add
193 test_expect_success
'Recursive test setup' '
195 echo qfwfq >frotz/nitfol &&
197 git commit -m "subdir test"
200 test_expect_success
'Recursive without -r fails' '
201 test_must_fail git rm frotz &&
202 test_path_is_dir frotz &&
203 test_path_is_file frotz/nitfol
206 test_expect_success
'Recursive with -r but dirty' '
207 echo qfwfq >>frotz/nitfol &&
208 test_must_fail git rm -r frotz &&
209 test_path_is_dir frotz &&
210 test_path_is_file frotz/nitfol
213 test_expect_success
'Recursive with -r -f' '
214 git rm -f -r frotz &&
215 test_path_is_missing frotz/nitfol &&
216 test_path_is_missing frotz
219 test_expect_success
'Remove nonexistent file returns nonzero exit status' '
220 test_must_fail git rm nonexistent
223 test_expect_success
'Call "rm" from outside the work tree' '
228 echo something >somefile &&
230 git commit -m "add a file" &&
233 git --git-dir=repo/.git --work-tree=repo rm somefile
235 test_must_fail git ls-files --error-unmatch somefile
239 test_expect_success
'refresh index before checking if it is up-to-date' '
241 test-tool chmtime -86400 frotz/nitfol &&
242 git rm frotz/nitfol &&
243 test_path_is_missing frotz/nitfol
246 test_expect_success
'choking "git rm" should not let it die with cruft' '
247 git reset -q --hard &&
248 test_when_finished "rm -f .git/index.lock && git reset -q --hard" &&
250 hash=$(test_oid deadbeef) &&
251 while test $i -lt 12000
253 echo "100644 $hash 0 some-file-$i"
255 done | git update-index --index-info &&
256 # git command is intentionally placed upstream of pipe to induce SIGPIPE
257 git rm -n "some-file-*" | : &&
258 test_path_is_missing .git/index.lock
261 test_expect_success
'Resolving by removal is not a warning-worthy event' '
262 git reset -q --hard &&
263 test_when_finished "rm -f .git/index.lock msg && git reset -q --hard" &&
264 blob=$(echo blob | git hash-object -w --stdin) &&
267 echo "100644 $blob $stage blob"
268 done | git update-index --index-info &&
269 git rm blob >msg 2>&1 &&
270 test_i18ngrep ! "needs merge" msg &&
271 test_must_fail git ls-files -s --error-unmatch blob
274 test_expect_success
'rm removes subdirectories recursively' '
275 mkdir -p dir/subdir/subsubdir &&
276 echo content >dir/subdir/subsubdir/file &&
277 git add dir/subdir/subsubdir/file &&
278 git rm -f dir/subdir/subsubdir/file &&
279 test_path_is_missing dir
287 cat >expect.modified
<<EOF
291 cat >expect.modified_inside
<<EOF
295 cat >expect.modified_untracked
<<EOF
299 cat >expect.cached
<<EOF
303 cat >expect.both_deleted
<<EOF
308 test_expect_success
'rm removes empty submodules from work tree' '
310 hash=$(git rev-parse HEAD) &&
311 git update-index --add --cacheinfo 160000 "$hash" submod &&
312 git config -f .gitmodules submodule.sub.url ./. &&
313 git config -f .gitmodules submodule.sub.path submod &&
314 git submodule init &&
315 git add .gitmodules &&
316 git commit -m "add submodule" &&
318 test_path_is_missing submod &&
319 git status -s -uno --ignore-submodules=none >actual &&
320 test_cmp expect actual &&
321 test_must_fail git config -f .gitmodules submodule.sub.url &&
322 test_must_fail git config -f .gitmodules submodule.sub.path
325 test_expect_success
'rm removes removed submodule from index and .gitmodules' '
327 git submodule update &&
330 git status -s -uno --ignore-submodules=none >actual &&
331 test_cmp expect actual &&
332 test_must_fail git config -f .gitmodules submodule.sub.url &&
333 test_must_fail git config -f .gitmodules submodule.sub.path
336 test_expect_success
'rm removes work tree of unmodified submodules' '
338 git submodule update &&
340 test_path_is_missing submod &&
341 git status -s -uno --ignore-submodules=none >actual &&
342 test_cmp expect actual &&
343 test_must_fail git config -f .gitmodules submodule.sub.url &&
344 test_must_fail git config -f .gitmodules submodule.sub.path
347 test_expect_success
'rm removes a submodule with a trailing /' '
349 git submodule update &&
351 test_path_is_missing submod &&
352 git status -s -uno --ignore-submodules=none >actual &&
353 test_cmp expect actual
356 test_expect_success
'rm fails when given a file with a trailing /' '
357 test_must_fail git rm empty/
360 test_expect_success
'rm succeeds when given a directory with a trailing /' '
364 test_expect_success
'rm of a populated submodule with different HEAD fails unless forced' '
366 git submodule update &&
367 git -C submod checkout HEAD^ &&
368 test_must_fail git rm submod &&
369 test_path_is_dir submod &&
370 test_path_is_file submod/.git &&
371 git status -s -uno --ignore-submodules=none >actual &&
372 test_cmp expect.modified actual &&
374 test_path_is_missing submod &&
375 git status -s -uno --ignore-submodules=none >actual &&
376 test_cmp expect actual &&
377 test_must_fail git config -f .gitmodules submodule.sub.url &&
378 test_must_fail git config -f .gitmodules submodule.sub.path
381 test_expect_success
'rm --cached leaves work tree of populated submodules and .gitmodules alone' '
383 git submodule update &&
384 git rm --cached submod &&
385 test_path_is_dir submod &&
386 test_path_is_file submod/.git &&
387 git status -s -uno >actual &&
388 test_cmp expect.cached actual &&
389 git config -f .gitmodules submodule.sub.url &&
390 git config -f .gitmodules submodule.sub.path
393 test_expect_success
'rm --dry-run does not touch the submodule or .gitmodules' '
395 git submodule update &&
397 test_path_is_file submod/.git &&
398 git diff-index --exit-code HEAD
401 test_expect_success
'rm does not complain when no .gitmodules file is found' '
403 git submodule update &&
404 git rm .gitmodules &&
405 git rm submod >actual 2>actual.err &&
406 test_must_be_empty actual.err &&
407 test_path_is_missing submod &&
408 test_path_is_missing submod/.git &&
409 git status -s -uno >actual &&
410 test_cmp expect.both_deleted actual
413 test_expect_success
'rm will error out on a modified .gitmodules file unless staged' '
415 git submodule update &&
416 git config -f .gitmodules foo.bar true &&
417 test_must_fail git rm submod >actual 2>actual.err &&
418 test_file_not_empty actual.err &&
419 test_path_is_dir submod &&
420 test_path_is_file submod/.git &&
421 git diff-files --quiet -- submod &&
422 git add .gitmodules &&
423 git rm submod >actual 2>actual.err &&
424 test_must_be_empty actual.err &&
425 test_path_is_missing submod &&
426 test_path_is_missing submod/.git &&
427 git status -s -uno >actual &&
428 test_cmp expect actual
430 test_expect_success
'rm will not error out on .gitmodules file with zero stat data' '
432 git submodule update &&
433 git read-tree HEAD &&
435 test_path_is_missing submod
438 test_expect_success
'rm issues a warning when section is not found in .gitmodules' '
440 git submodule update &&
441 git config -f .gitmodules --remove-section submodule.sub &&
442 git add .gitmodules &&
443 echo "warning: Could not find section in .gitmodules where path=submod" >expect.err &&
444 git rm submod >actual 2>actual.err &&
445 test_i18ncmp expect.err actual.err &&
446 test_path_is_missing submod &&
447 test_path_is_missing submod/.git &&
448 git status -s -uno >actual &&
449 test_cmp expect actual
452 test_expect_success
'rm of a populated submodule with modifications fails unless forced' '
454 git submodule update &&
455 echo X >submod/empty &&
456 test_must_fail git rm submod &&
457 test_path_is_dir submod &&
458 test_path_is_file submod/.git &&
459 git status -s -uno --ignore-submodules=none >actual &&
460 test_cmp expect.modified_inside actual &&
462 test_path_is_missing submod &&
463 git status -s -uno --ignore-submodules=none >actual &&
464 test_cmp expect actual
467 test_expect_success
'rm of a populated submodule with untracked files fails unless forced' '
469 git submodule update &&
470 echo X >submod/untracked &&
471 test_must_fail git rm submod &&
472 test_path_is_dir submod &&
473 test_path_is_file submod/.git &&
474 git status -s -uno --ignore-submodules=none >actual &&
475 test_cmp expect.modified_untracked actual &&
477 test_path_is_missing submod &&
478 git status -s -uno --ignore-submodules=none >actual &&
479 test_cmp expect actual
482 test_expect_success
'setup submodule conflict' '
484 git submodule update &&
485 git checkout -b branch1 &&
488 git commit -m "added nitfol 1" &&
489 git checkout -b branch2 master &&
492 git commit -m "added nitfol 2" &&
493 git checkout -b conflict1 master &&
494 git -C submod fetch &&
495 git -C submod checkout branch1 &&
497 git commit -m "submod 1" &&
498 git checkout -b conflict2 master &&
499 git -C submod checkout branch2 &&
501 git commit -m "submod 2"
504 cat >expect.conflict
<<EOF
508 test_expect_success
'rm removes work tree of unmodified conflicted submodule' '
509 git checkout conflict1 &&
511 git submodule update &&
512 test_must_fail git merge conflict2 &&
514 test_path_is_missing submod &&
515 git status -s -uno --ignore-submodules=none >actual &&
516 test_cmp expect actual
519 test_expect_success
'rm of a conflicted populated submodule with different HEAD fails unless forced' '
520 git checkout conflict1 &&
522 git submodule update &&
523 git -C submod checkout HEAD^ &&
524 test_must_fail git merge conflict2 &&
525 test_must_fail git rm submod &&
526 test_path_is_dir submod &&
527 test_path_is_file submod/.git &&
528 git status -s -uno --ignore-submodules=none >actual &&
529 test_cmp expect.conflict actual &&
531 test_path_is_missing submod &&
532 git status -s -uno --ignore-submodules=none >actual &&
533 test_cmp expect actual &&
534 test_must_fail git config -f .gitmodules submodule.sub.url &&
535 test_must_fail git config -f .gitmodules submodule.sub.path
538 test_expect_success
'rm of a conflicted populated submodule with modifications fails unless forced' '
539 git checkout conflict1 &&
541 git submodule update &&
542 echo X >submod/empty &&
543 test_must_fail git merge conflict2 &&
544 test_must_fail git rm submod &&
545 test_path_is_dir submod &&
546 test_path_is_file submod/.git &&
547 git status -s -uno --ignore-submodules=none >actual &&
548 test_cmp expect.conflict actual &&
550 test_path_is_missing submod &&
551 git status -s -uno --ignore-submodules=none >actual &&
552 test_cmp expect actual &&
553 test_must_fail git config -f .gitmodules submodule.sub.url &&
554 test_must_fail git config -f .gitmodules submodule.sub.path
557 test_expect_success
'rm of a conflicted populated submodule with untracked files fails unless forced' '
558 git checkout conflict1 &&
560 git submodule update &&
561 echo X >submod/untracked &&
562 test_must_fail git merge conflict2 &&
563 test_must_fail git rm submod &&
564 test_path_is_dir submod &&
565 test_path_is_file submod/.git &&
566 git status -s -uno --ignore-submodules=none >actual &&
567 test_cmp expect.conflict actual &&
569 test_path_is_missing submod &&
570 git status -s -uno --ignore-submodules=none >actual &&
571 test_cmp expect actual
574 test_expect_success
'rm of a conflicted populated submodule with a .git directory fails even when forced' '
575 git checkout conflict1 &&
577 git submodule update &&
581 cp -R ../.git/modules/sub .git &&
582 GIT_WORK_TREE=. git config --unset core.worktree
584 test_must_fail git merge conflict2 &&
585 test_must_fail git rm submod &&
586 test_path_is_dir submod &&
587 test_path_is_dir submod/.git &&
588 git status -s -uno --ignore-submodules=none >actual &&
589 test_cmp expect.conflict actual &&
590 test_must_fail git rm -f submod &&
591 test_path_is_dir submod &&
592 test_path_is_dir submod/.git &&
593 git status -s -uno --ignore-submodules=none >actual &&
594 test_cmp expect.conflict actual &&
599 test_expect_success
'rm of a conflicted unpopulated submodule succeeds' '
600 git checkout conflict1 &&
602 test_must_fail git merge conflict2 &&
604 test_path_is_missing submod &&
605 git status -s -uno --ignore-submodules=none >actual &&
606 test_cmp expect actual
609 test_expect_success
'rm of a populated submodule with a .git directory migrates git dir' '
610 git checkout -f master &&
612 git submodule update &&
616 cp -R ../.git/modules/sub .git &&
617 GIT_WORK_TREE=. git config --unset core.worktree &&
618 rm -r ../.git/modules/sub
620 git rm submod 2>output.err &&
621 test_path_is_missing submod &&
622 test_path_is_missing submod/.git &&
623 git status -s -uno --ignore-submodules=none >actual &&
624 test_file_not_empty actual &&
625 test_i18ngrep Migrating output.err
628 cat >expect.deepmodified
<<EOF
632 test_expect_success
'setup subsubmodule' '
634 git submodule update &&
637 hash=$(git rev-parse HEAD) &&
638 git update-index --add --cacheinfo 160000 "$hash" subsubmod &&
639 git config -f .gitmodules submodule.sub.url ../. &&
640 git config -f .gitmodules submodule.sub.path subsubmod &&
641 git submodule init &&
642 git add .gitmodules &&
643 git commit -m "add subsubmodule" &&
644 git submodule update subsubmod
646 git commit -a -m "added deep submodule"
649 test_expect_success
'rm recursively removes work tree of unmodified submodules' '
651 test_path_is_missing submod &&
652 git status -s -uno --ignore-submodules=none >actual &&
653 test_cmp expect actual
656 test_expect_success
'rm of a populated nested submodule with different nested HEAD fails unless forced' '
658 git submodule update --recursive &&
659 git -C submod/subsubmod checkout HEAD^ &&
660 test_must_fail git rm submod &&
661 test_path_is_dir submod &&
662 test_path_is_file submod/.git &&
663 git status -s -uno --ignore-submodules=none >actual &&
664 test_cmp expect.modified_inside actual &&
666 test_path_is_missing submod &&
667 git status -s -uno --ignore-submodules=none >actual &&
668 test_cmp expect actual
671 test_expect_success
'rm of a populated nested submodule with nested modifications fails unless forced' '
673 git submodule update --recursive &&
674 echo X >submod/subsubmod/empty &&
675 test_must_fail git rm submod &&
676 test_path_is_dir submod &&
677 test_path_is_file submod/.git &&
678 git status -s -uno --ignore-submodules=none >actual &&
679 test_cmp expect.modified_inside actual &&
681 test_path_is_missing submod &&
682 git status -s -uno --ignore-submodules=none >actual &&
683 test_cmp expect actual
686 test_expect_success
'rm of a populated nested submodule with nested untracked files fails unless forced' '
688 git submodule update --recursive &&
689 echo X >submod/subsubmod/untracked &&
690 test_must_fail git rm submod &&
691 test_path_is_dir submod &&
692 test_path_is_file submod/.git &&
693 git status -s -uno --ignore-submodules=none >actual &&
694 test_cmp expect.modified_untracked actual &&
696 test_path_is_missing submod &&
697 git status -s -uno --ignore-submodules=none >actual &&
698 test_cmp expect actual
701 test_expect_success
"rm absorbs submodule's nested .git directory" '
703 git submodule update --recursive &&
705 cd submod/subsubmod &&
707 mv ../../.git/modules/sub/modules/sub .git &&
708 GIT_WORK_TREE=. git config --unset core.worktree
710 git rm submod 2>output.err &&
711 test_path_is_missing submod &&
712 test_path_is_missing submod/subsubmod/.git &&
713 git status -s -uno --ignore-submodules=none >actual &&
714 test_file_not_empty actual &&
715 test_i18ngrep Migrating output.err
718 test_expect_success
'checking out a commit after submodule removal needs manual updates' '
719 git commit -m "submodule removal" submod .gitmodules &&
720 git checkout HEAD^ &&
721 git submodule update &&
722 git checkout -q HEAD^ &&
723 git checkout -q master 2>actual &&
724 test_i18ngrep "^warning: unable to rmdir '\''submod'\'':" actual &&
725 git status -s submod >actual &&
726 echo "?? submod/" >expected &&
727 test_cmp expected actual &&
729 git status -s -uno --ignore-submodules=none >actual &&
730 test_must_be_empty actual
733 test_expect_success
'rm of d/f when d has become a non-directory' '
741 test_must_fail git rev-parse --verify :d/f &&
745 test_expect_success SYMLINKS
'rm of d/f when d has become a dangling symlink' '
751 ln -s nonexistent d &&
753 test_must_fail git rev-parse --verify :d/f &&
755 test_path_is_missing d
758 test_expect_success
'rm of file when it has become a directory' '
765 test_must_fail git rm d &&
766 git rev-parse --verify :d &&
767 test_path_is_file d/f
770 test_expect_success SYMLINKS
'rm across a symlinked leading path (no index)' '
776 git commit -m "symlink d to e, e/f exists" &&
777 test_must_fail git rm d/f &&
778 git rev-parse --verify :d &&
779 git rev-parse --verify :e/f &&
781 test_path_is_file e/f
784 test_expect_failure SYMLINKS
'rm across a symlinked leading path (w/ index)' '
789 git commit -m "d/f exists" &&
792 test_must_fail git rm d/f &&
793 git rev-parse --verify :d/f &&
795 test_path_is_file e/f
798 test_expect_success
'setup for testing rm messages' '
801 git add bar.txt foo.txt
804 test_expect_success
'rm files with different staged content' '
805 cat >expect <<-\EOF &&
806 error: the following files have staged content different from both the
810 (use -f to force removal)
812 echo content1 >foo.txt &&
813 echo content1 >bar.txt &&
814 test_must_fail git rm foo.txt bar.txt 2>actual &&
815 test_i18ncmp expect actual
818 test_expect_success
'rm files with different staged content without hints' '
819 cat >expect <<-\EOF &&
820 error: the following files have staged content different from both the
825 echo content2 >foo.txt &&
826 echo content2 >bar.txt &&
827 test_must_fail git -c advice.rmhints=false rm foo.txt bar.txt 2>actual &&
828 test_i18ncmp expect actual
831 test_expect_success
'rm file with local modification' '
832 cat >expect <<-\EOF &&
833 error: the following file has local modifications:
835 (use --cached to keep the file, or -f to force removal)
837 git commit -m "testing rm 3" &&
838 echo content3 >foo.txt &&
839 test_must_fail git rm foo.txt 2>actual &&
840 test_i18ncmp expect actual
843 test_expect_success
'rm file with local modification without hints' '
844 cat >expect <<-\EOF &&
845 error: the following file has local modifications:
848 echo content4 >bar.txt &&
849 test_must_fail git -c advice.rmhints=false rm bar.txt 2>actual &&
850 test_i18ncmp expect actual
853 test_expect_success
'rm file with changes in the index' '
854 cat >expect <<-\EOF &&
855 error: the following file has changes staged in the index:
857 (use --cached to keep the file, or -f to force removal)
860 echo content5 >foo.txt &&
862 test_must_fail git rm foo.txt 2>actual &&
863 test_i18ncmp expect actual
866 test_expect_success
'rm file with changes in the index without hints' '
867 cat >expect <<-\EOF &&
868 error: the following file has changes staged in the index:
871 test_must_fail git -c advice.rmhints=false rm foo.txt 2>actual &&
872 test_i18ncmp expect actual
875 test_expect_success
'rm files with two different errors' '
876 cat >expect <<-\EOF &&
877 error: the following file has staged content different from both the
880 (use -f to force removal)
881 error: the following file has changes staged in the index:
883 (use --cached to keep the file, or -f to force removal)
885 echo content >foo1.txt &&
887 echo content6 >foo1.txt &&
888 echo content6 >bar1.txt &&
890 test_must_fail git rm bar1.txt foo1.txt 2>actual &&
891 test_i18ncmp expect actual
894 test_expect_success
'rm empty string should fail' '
895 test_must_fail git rm -rf ""