3 # Copyright (c) 2006 Carl D. Worth
6 test_description='Test of the various options to git rm.'
10 # Setup some files to be removed, some with funny characters
11 test_expect_success 'Initialize test directory' '
12 touch -- foo bar baz "space embedded" -q &&
13 git add -- foo bar baz "space embedded" -q &&
14 git commit -m "add normal files"
17 if test_have_prereq !FUNNYNAMES
19 say 'Your filesystem does not allow tabs in filenames.'
22 test_expect_success FUNNYNAMES 'add files with funny names' '
23 touch -- "tab embedded" "newline${LF}embedded" &&
24 git add -- "tab embedded" "newline${LF}embedded" &&
25 git commit -m "add files with tabs and newlines"
28 test_expect_success 'Pre-check that foo exists and is in index before git rm foo' '
29 test_path_is_file foo &&
30 git ls-files --error-unmatch foo
33 test_expect_success 'Test that git rm foo succeeds' '
37 test_expect_success 'Test that git rm --cached foo succeeds if the index matches the file' '
43 test_expect_success 'Test that git rm --cached foo succeeds if the index matches the file' '
47 echo "other content" >foo &&
51 test_expect_success 'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' '
54 git commit -m foo --allow-empty &&
55 echo "other content" >foo &&
57 echo "yet another content" >foo &&
58 test_must_fail git rm --cached foo
61 test_expect_success 'Test that git rm --cached -f foo works in case where --cached only did not' '
64 git commit -m foo --allow-empty &&
65 echo "other content" >foo &&
67 echo "yet another content" >foo &&
68 git rm --cached -f foo
71 test_expect_success 'Post-check that foo exists but is not in index after git rm foo' '
72 test_path_is_file foo &&
73 test_must_fail git ls-files --error-unmatch foo
76 test_expect_success 'Pre-check that bar exists and is in index before "git rm bar"' '
77 test_path_is_file bar &&
78 git ls-files --error-unmatch bar
81 test_expect_success 'Test that "git rm bar" succeeds' '
85 test_expect_success 'Post-check that bar does not exist and is not in index after "git rm -f bar"' '
86 test_path_is_missing bar &&
87 test_must_fail git ls-files --error-unmatch bar
90 test_expect_success 'Test that "git rm -- -q" succeeds (remove a file that looks like an option)' '
94 test_expect_success FUNNYNAMES 'Test that "git rm -f" succeeds with embedded space, tab, or newline characters.' '
95 git rm -f "space embedded" "tab embedded" "newline${LF}embedded"
98 test_expect_success SANITY 'Test that "git rm -f" fails if its rm fails' '
99 test_when_finished "chmod 775 ." &&
101 test_must_fail git rm -f baz
104 test_expect_success 'When the rm in "git rm -f" fails, it should not remove the file from the index' '
105 git ls-files --error-unmatch baz
108 test_expect_success 'Remove nonexistent file with --ignore-unmatch' '
109 git rm --ignore-unmatch nonexistent
112 test_expect_success '"rm" command printed' '
113 echo frotz >test-file &&
115 git commit -m "add file for rm test" &&
116 git rm test-file >rm-output.raw &&
117 grep "^rm " rm-output.raw >rm-output &&
118 test_line_count = 1 rm-output &&
119 rm -f test-file rm-output.raw rm-output &&
120 git commit -m "remove file from rm test"
123 test_expect_success '"rm" command suppressed with --quiet' '
124 echo frotz >test-file &&
126 git commit -m "add file for rm --quiet test" &&
127 git rm --quiet test-file >rm-output &&
128 test_must_be_empty rm-output &&
129 rm -f test-file rm-output &&
130 git commit -m "remove file from rm --quiet test"
133 # Now, failure cases.
134 test_expect_success 'Re-add foo and baz' '
136 git ls-files --error-unmatch foo baz
139 test_expect_success 'Modify foo -- rm should refuse' '
141 test_must_fail git rm foo baz &&
142 test_path_is_file foo &&
143 test_path_is_file baz &&
144 git ls-files --error-unmatch foo baz
147 test_expect_success 'Modified foo -- rm -f should work' '
149 test_path_is_missing foo &&
150 test_path_is_missing baz &&
151 test_must_fail git ls-files --error-unmatch foo &&
152 test_must_fail git ls-files --error-unmatch bar
155 test_expect_success 'Re-add foo and baz for HEAD tests' '
157 git checkout HEAD -- baz &&
159 git ls-files --error-unmatch foo baz
162 test_expect_success 'foo is different in index from HEAD -- rm should refuse' '
163 test_must_fail git rm foo baz &&
164 test_path_is_file foo &&
165 test_path_is_file baz &&
166 git ls-files --error-unmatch foo baz
169 test_expect_success 'but with -f it should work.' '
171 test_path_is_missing foo &&
172 test_path_is_missing baz &&
173 test_must_fail git ls-files --error-unmatch foo &&
174 test_must_fail git ls-files --error-unmatch baz
177 test_expect_success 'refuse to remove cached empty file with modifications' '
180 echo content >empty &&
181 test_must_fail git rm --cached empty
184 test_expect_success 'remove intent-to-add file without --force' '
185 echo content >intent-to-add &&
186 git add -N intent-to-add &&
187 git rm --cached intent-to-add
190 test_expect_success 'Recursive test setup' '
192 echo qfwfq >frotz/nitfol &&
194 git commit -m "subdir test"
197 test_expect_success 'Recursive without -r fails' '
198 test_must_fail git rm frotz &&
199 test_path_is_dir frotz &&
200 test_path_is_file frotz/nitfol
203 test_expect_success 'Recursive with -r but dirty' '
204 echo qfwfq >>frotz/nitfol &&
205 test_must_fail git rm -r frotz &&
206 test_path_is_dir frotz &&
207 test_path_is_file frotz/nitfol
210 test_expect_success 'Recursive with -r -f' '
211 git rm -f -r frotz &&
212 test_path_is_missing frotz/nitfol &&
213 test_path_is_missing frotz
216 test_expect_success 'Remove nonexistent file returns nonzero exit status' '
217 test_must_fail git rm nonexistent
220 test_expect_success 'Call "rm" from outside the work tree' '
225 echo something >somefile &&
227 git commit -m "add a file" &&
230 git --git-dir=repo/.git --work-tree=repo rm somefile
232 test_must_fail git ls-files --error-unmatch somefile
236 test_expect_success 'refresh index before checking if it is up-to-date' '
238 test-tool chmtime -86400 frotz/nitfol &&
239 git rm frotz/nitfol &&
240 test_path_is_missing frotz/nitfol
243 test_expect_success 'choking "git rm" should not let it die with cruft' '
244 git reset -q --hard &&
245 test_when_finished "rm -f .git/index.lock && git reset -q --hard" &&
247 hash=$(test_oid deadbeef) &&
248 while test $i -lt 12000
250 echo "100644 $hash 0 some-file-$i"
252 done | git update-index --index-info &&
253 # git command is intentionally placed upstream of pipe to induce SIGPIPE
254 git rm -n "some-file-*" | : &&
255 test_path_is_missing .git/index.lock
258 test_expect_success 'Resolving by removal is not a warning-worthy event' '
259 git reset -q --hard &&
260 test_when_finished "rm -f .git/index.lock msg && git reset -q --hard" &&
261 blob=$(echo blob | git hash-object -w --stdin) &&
264 echo "100644 $blob $stage blob"
265 done | git update-index --index-info &&
266 git rm blob >msg 2>&1 &&
267 test_i18ngrep ! "needs merge" msg &&
268 test_must_fail git ls-files -s --error-unmatch blob
271 test_expect_success 'rm removes subdirectories recursively' '
272 mkdir -p dir/subdir/subsubdir &&
273 echo content >dir/subdir/subsubdir/file &&
274 git add dir/subdir/subsubdir/file &&
275 git rm -f dir/subdir/subsubdir/file &&
276 test_path_is_missing dir
284 cat >expect.modified <<EOF
288 cat >expect.modified_inside <<EOF
292 cat >expect.modified_untracked <<EOF
296 cat >expect.cached <<EOF
300 cat >expect.both_deleted<<EOF
305 test_expect_success 'rm removes empty submodules from work tree' '
307 hash=$(git rev-parse HEAD) &&
308 git update-index --add --cacheinfo 160000 "$hash" submod &&
309 git config -f .gitmodules submodule.sub.url ./. &&
310 git config -f .gitmodules submodule.sub.path submod &&
311 git submodule init &&
312 git add .gitmodules &&
313 git commit -m "add submodule" &&
315 test_path_is_missing submod &&
316 git status -s -uno --ignore-submodules=none >actual &&
317 test_cmp expect actual &&
318 test_must_fail git config -f .gitmodules submodule.sub.url &&
319 test_must_fail git config -f .gitmodules submodule.sub.path
322 test_expect_success 'rm removes removed submodule from index and .gitmodules' '
324 git submodule update &&
327 git status -s -uno --ignore-submodules=none >actual &&
328 test_cmp expect actual &&
329 test_must_fail git config -f .gitmodules submodule.sub.url &&
330 test_must_fail git config -f .gitmodules submodule.sub.path
333 test_expect_success 'rm removes work tree of unmodified submodules' '
335 git submodule update &&
337 test_path_is_missing submod &&
338 git status -s -uno --ignore-submodules=none >actual &&
339 test_cmp expect actual &&
340 test_must_fail git config -f .gitmodules submodule.sub.url &&
341 test_must_fail git config -f .gitmodules submodule.sub.path
344 test_expect_success 'rm removes a submodule with a trailing /' '
346 git submodule update &&
348 test_path_is_missing submod &&
349 git status -s -uno --ignore-submodules=none >actual &&
350 test_cmp expect actual
353 test_expect_success 'rm fails when given a file with a trailing /' '
354 test_must_fail git rm empty/
357 test_expect_success 'rm succeeds when given a directory with a trailing /' '
361 test_expect_success 'rm of a populated submodule with different HEAD fails unless forced' '
363 git submodule update &&
364 git -C submod checkout HEAD^ &&
365 test_must_fail git rm submod &&
366 test_path_is_dir submod &&
367 test_path_is_file submod/.git &&
368 git status -s -uno --ignore-submodules=none >actual &&
369 test_cmp expect.modified actual &&
371 test_path_is_missing submod &&
372 git status -s -uno --ignore-submodules=none >actual &&
373 test_cmp expect actual &&
374 test_must_fail git config -f .gitmodules submodule.sub.url &&
375 test_must_fail git config -f .gitmodules submodule.sub.path
378 test_expect_success 'rm --cached leaves work tree of populated submodules and .gitmodules alone' '
380 git submodule update &&
381 git rm --cached submod &&
382 test_path_is_dir submod &&
383 test_path_is_file submod/.git &&
384 git status -s -uno >actual &&
385 test_cmp expect.cached actual &&
386 git config -f .gitmodules submodule.sub.url &&
387 git config -f .gitmodules submodule.sub.path
390 test_expect_success 'rm --dry-run does not touch the submodule or .gitmodules' '
392 git submodule update &&
394 test_path_is_file submod/.git &&
395 git diff-index --exit-code HEAD
398 test_expect_success 'rm does not complain when no .gitmodules file is found' '
400 git submodule update &&
401 git rm .gitmodules &&
402 git rm submod >actual 2>actual.err &&
403 test_must_be_empty actual.err &&
404 test_path_is_missing submod &&
405 test_path_is_missing submod/.git &&
406 git status -s -uno >actual &&
407 test_cmp expect.both_deleted actual
410 test_expect_success 'rm will error out on a modified .gitmodules file unless staged' '
412 git submodule update &&
413 git config -f .gitmodules foo.bar true &&
414 test_must_fail git rm submod >actual 2>actual.err &&
415 test_file_not_empty actual.err &&
416 test_path_is_dir submod &&
417 test_path_is_file submod/.git &&
418 git diff-files --quiet -- submod &&
419 git add .gitmodules &&
420 git rm submod >actual 2>actual.err &&
421 test_must_be_empty actual.err &&
422 test_path_is_missing submod &&
423 test_path_is_missing submod/.git &&
424 git status -s -uno >actual &&
425 test_cmp expect actual
427 test_expect_success 'rm will not error out on .gitmodules file with zero stat data' '
429 git submodule update &&
430 git read-tree HEAD &&
432 test_path_is_missing submod
435 test_expect_success 'rm issues a warning when section is not found in .gitmodules' '
437 git submodule update &&
438 git config -f .gitmodules --remove-section submodule.sub &&
439 git add .gitmodules &&
440 echo "warning: Could not find section in .gitmodules where path=submod" >expect.err &&
441 git rm submod >actual 2>actual.err &&
442 test_i18ncmp expect.err actual.err &&
443 test_path_is_missing submod &&
444 test_path_is_missing submod/.git &&
445 git status -s -uno >actual &&
446 test_cmp expect actual
449 test_expect_success 'rm of a populated submodule with modifications fails unless forced' '
451 git submodule update &&
452 echo X >submod/empty &&
453 test_must_fail git rm submod &&
454 test_path_is_dir submod &&
455 test_path_is_file submod/.git &&
456 git status -s -uno --ignore-submodules=none >actual &&
457 test_cmp expect.modified_inside actual &&
459 test_path_is_missing submod &&
460 git status -s -uno --ignore-submodules=none >actual &&
461 test_cmp expect actual
464 test_expect_success 'rm of a populated submodule with untracked files fails unless forced' '
466 git submodule update &&
467 echo X >submod/untracked &&
468 test_must_fail git rm submod &&
469 test_path_is_dir submod &&
470 test_path_is_file submod/.git &&
471 git status -s -uno --ignore-submodules=none >actual &&
472 test_cmp expect.modified_untracked actual &&
474 test_path_is_missing submod &&
475 git status -s -uno --ignore-submodules=none >actual &&
476 test_cmp expect actual
479 test_expect_success 'setup submodule conflict' '
481 git submodule update &&
482 git checkout -b branch1 &&
485 git commit -m "added nitfol 1" &&
486 git checkout -b branch2 master &&
489 git commit -m "added nitfol 2" &&
490 git checkout -b conflict1 master &&
491 git -C submod fetch &&
492 git -C submod checkout branch1 &&
494 git commit -m "submod 1" &&
495 git checkout -b conflict2 master &&
496 git -C submod checkout branch2 &&
498 git commit -m "submod 2"
501 cat >expect.conflict <<EOF
505 test_expect_success 'rm removes work tree of unmodified conflicted submodule' '
506 git checkout conflict1 &&
508 git submodule update &&
509 test_must_fail git merge conflict2 &&
511 test_path_is_missing submod &&
512 git status -s -uno --ignore-submodules=none >actual &&
513 test_cmp expect actual
516 test_expect_success 'rm of a conflicted populated submodule with different HEAD fails unless forced' '
517 git checkout conflict1 &&
519 git submodule update &&
520 git -C submod checkout HEAD^ &&
521 test_must_fail git merge conflict2 &&
522 test_must_fail git rm submod &&
523 test_path_is_dir submod &&
524 test_path_is_file submod/.git &&
525 git status -s -uno --ignore-submodules=none >actual &&
526 test_cmp expect.conflict actual &&
528 test_path_is_missing submod &&
529 git status -s -uno --ignore-submodules=none >actual &&
530 test_cmp expect actual &&
531 test_must_fail git config -f .gitmodules submodule.sub.url &&
532 test_must_fail git config -f .gitmodules submodule.sub.path
535 test_expect_success 'rm of a conflicted populated submodule with modifications fails unless forced' '
536 git checkout conflict1 &&
538 git submodule update &&
539 echo X >submod/empty &&
540 test_must_fail git merge conflict2 &&
541 test_must_fail git rm submod &&
542 test_path_is_dir submod &&
543 test_path_is_file submod/.git &&
544 git status -s -uno --ignore-submodules=none >actual &&
545 test_cmp expect.conflict actual &&
547 test_path_is_missing submod &&
548 git status -s -uno --ignore-submodules=none >actual &&
549 test_cmp expect actual &&
550 test_must_fail git config -f .gitmodules submodule.sub.url &&
551 test_must_fail git config -f .gitmodules submodule.sub.path
554 test_expect_success 'rm of a conflicted populated submodule with untracked files fails unless forced' '
555 git checkout conflict1 &&
557 git submodule update &&
558 echo X >submod/untracked &&
559 test_must_fail git merge conflict2 &&
560 test_must_fail git rm submod &&
561 test_path_is_dir submod &&
562 test_path_is_file submod/.git &&
563 git status -s -uno --ignore-submodules=none >actual &&
564 test_cmp expect.conflict actual &&
566 test_path_is_missing submod &&
567 git status -s -uno --ignore-submodules=none >actual &&
568 test_cmp expect actual
571 test_expect_success 'rm of a conflicted populated submodule with a .git directory fails even when forced' '
572 git checkout conflict1 &&
574 git submodule update &&
578 cp -R ../.git/modules/sub .git &&
579 GIT_WORK_TREE=. git config --unset core.worktree
581 test_must_fail git merge conflict2 &&
582 test_must_fail git rm submod &&
583 test_path_is_dir submod &&
584 test_path_is_dir submod/.git &&
585 git status -s -uno --ignore-submodules=none >actual &&
586 test_cmp expect.conflict actual &&
587 test_must_fail git rm -f submod &&
588 test_path_is_dir submod &&
589 test_path_is_dir submod/.git &&
590 git status -s -uno --ignore-submodules=none >actual &&
591 test_cmp expect.conflict actual &&
596 test_expect_success 'rm of a conflicted unpopulated submodule succeeds' '
597 git checkout conflict1 &&
599 test_must_fail git merge conflict2 &&
601 test_path_is_missing submod &&
602 git status -s -uno --ignore-submodules=none >actual &&
603 test_cmp expect actual
606 test_expect_success 'rm of a populated submodule with a .git directory migrates git dir' '
607 git checkout -f master &&
609 git submodule update &&
613 cp -R ../.git/modules/sub .git &&
614 GIT_WORK_TREE=. git config --unset core.worktree &&
615 rm -r ../.git/modules/sub
617 git rm submod 2>output.err &&
618 test_path_is_missing submod &&
619 test_path_is_missing submod/.git &&
620 git status -s -uno --ignore-submodules=none >actual &&
621 test_file_not_empty actual &&
622 test_i18ngrep Migrating output.err
625 cat >expect.deepmodified <<EOF
629 test_expect_success 'setup subsubmodule' '
631 git submodule update &&
634 hash=$(git rev-parse HEAD) &&
635 git update-index --add --cacheinfo 160000 "$hash" subsubmod &&
636 git config -f .gitmodules submodule.sub.url ../. &&
637 git config -f .gitmodules submodule.sub.path subsubmod &&
638 git submodule init &&
639 git add .gitmodules &&
640 git commit -m "add subsubmodule" &&
641 git submodule update subsubmod
643 git commit -a -m "added deep submodule"
646 test_expect_success 'rm recursively removes work tree of unmodified submodules' '
648 test_path_is_missing submod &&
649 git status -s -uno --ignore-submodules=none >actual &&
650 test_cmp expect actual
653 test_expect_success 'rm of a populated nested submodule with different nested HEAD fails unless forced' '
655 git submodule update --recursive &&
656 git -C submod/subsubmod checkout HEAD^ &&
657 test_must_fail git rm submod &&
658 test_path_is_dir submod &&
659 test_path_is_file submod/.git &&
660 git status -s -uno --ignore-submodules=none >actual &&
661 test_cmp expect.modified_inside actual &&
663 test_path_is_missing submod &&
664 git status -s -uno --ignore-submodules=none >actual &&
665 test_cmp expect actual
668 test_expect_success 'rm of a populated nested submodule with nested modifications fails unless forced' '
670 git submodule update --recursive &&
671 echo X >submod/subsubmod/empty &&
672 test_must_fail git rm submod &&
673 test_path_is_dir submod &&
674 test_path_is_file submod/.git &&
675 git status -s -uno --ignore-submodules=none >actual &&
676 test_cmp expect.modified_inside actual &&
678 test_path_is_missing submod &&
679 git status -s -uno --ignore-submodules=none >actual &&
680 test_cmp expect actual
683 test_expect_success 'rm of a populated nested submodule with nested untracked files fails unless forced' '
685 git submodule update --recursive &&
686 echo X >submod/subsubmod/untracked &&
687 test_must_fail git rm submod &&
688 test_path_is_dir submod &&
689 test_path_is_file submod/.git &&
690 git status -s -uno --ignore-submodules=none >actual &&
691 test_cmp expect.modified_untracked actual &&
693 test_path_is_missing submod &&
694 git status -s -uno --ignore-submodules=none >actual &&
695 test_cmp expect actual
698 test_expect_success "rm absorbs submodule's nested .git directory" '
700 git submodule update --recursive &&
702 cd submod/subsubmod &&
704 mv ../../.git/modules/sub/modules/sub .git &&
705 GIT_WORK_TREE=. git config --unset core.worktree
707 git rm submod 2>output.err &&
708 test_path_is_missing submod &&
709 test_path_is_missing submod/subsubmod/.git &&
710 git status -s -uno --ignore-submodules=none >actual &&
711 test_file_not_empty actual &&
712 test_i18ngrep Migrating output.err
715 test_expect_success 'checking out a commit after submodule removal needs manual updates' '
716 git commit -m "submodule removal" submod .gitmodules &&
717 git checkout HEAD^ &&
718 git submodule update &&
719 git checkout -q HEAD^ &&
720 git checkout -q master 2>actual &&
721 test_i18ngrep "^warning: unable to rmdir '\''submod'\'':" actual &&
722 git status -s submod >actual &&
723 echo "?? submod/" >expected &&
724 test_cmp expected actual &&
726 git status -s -uno --ignore-submodules=none >actual &&
727 test_must_be_empty actual
730 test_expect_success 'rm of d/f when d has become a non-directory' '
738 test_must_fail git rev-parse --verify :d/f &&
742 test_expect_success SYMLINKS 'rm of d/f when d has become a dangling symlink' '
748 ln -s nonexistent d &&
750 test_must_fail git rev-parse --verify :d/f &&
752 test_path_is_missing d
755 test_expect_success 'rm of file when it has become a directory' '
762 test_must_fail git rm d &&
763 git rev-parse --verify :d &&
764 test_path_is_file d/f
767 test_expect_success SYMLINKS 'rm across a symlinked leading path (no index)' '
773 git commit -m "symlink d to e, e/f exists" &&
774 test_must_fail git rm d/f &&
775 git rev-parse --verify :d &&
776 git rev-parse --verify :e/f &&
778 test_path_is_file e/f
781 test_expect_failure SYMLINKS 'rm across a symlinked leading path (w/ index)' '
786 git commit -m "d/f exists" &&
789 test_must_fail git rm d/f &&
790 git rev-parse --verify :d/f &&
792 test_path_is_file e/f
795 test_expect_success 'setup for testing rm messages' '
798 git add bar.txt foo.txt
801 test_expect_success 'rm files with different staged content' '
802 cat >expect <<-\EOF &&
803 error: the following files have staged content different from both the
807 (use -f to force removal)
809 echo content1 >foo.txt &&
810 echo content1 >bar.txt &&
811 test_must_fail git rm foo.txt bar.txt 2>actual &&
812 test_i18ncmp expect actual
815 test_expect_success 'rm files with different staged content without hints' '
816 cat >expect <<-\EOF &&
817 error: the following files have staged content different from both the
822 echo content2 >foo.txt &&
823 echo content2 >bar.txt &&
824 test_must_fail git -c advice.rmhints=false rm foo.txt bar.txt 2>actual &&
825 test_i18ncmp expect actual
828 test_expect_success 'rm file with local modification' '
829 cat >expect <<-\EOF &&
830 error: the following file has local modifications:
832 (use --cached to keep the file, or -f to force removal)
834 git commit -m "testing rm 3" &&
835 echo content3 >foo.txt &&
836 test_must_fail git rm foo.txt 2>actual &&
837 test_i18ncmp expect actual
840 test_expect_success 'rm file with local modification without hints' '
841 cat >expect <<-\EOF &&
842 error: the following file has local modifications:
845 echo content4 >bar.txt &&
846 test_must_fail git -c advice.rmhints=false rm bar.txt 2>actual &&
847 test_i18ncmp expect actual
850 test_expect_success 'rm file with changes in the index' '
851 cat >expect <<-\EOF &&
852 error: the following file has changes staged in the index:
854 (use --cached to keep the file, or -f to force removal)
857 echo content5 >foo.txt &&
859 test_must_fail git rm foo.txt 2>actual &&
860 test_i18ncmp expect actual
863 test_expect_success 'rm file with changes in the index without hints' '
864 cat >expect <<-\EOF &&
865 error: the following file has changes staged in the index:
868 test_must_fail git -c advice.rmhints=false rm foo.txt 2>actual &&
869 test_i18ncmp expect actual
872 test_expect_success 'rm files with two different errors' '
873 cat >expect <<-\EOF &&
874 error: the following file has staged content different from both the
877 (use -f to force removal)
878 error: the following file has changes staged in the index:
880 (use --cached to keep the file, or -f to force removal)
882 echo content >foo1.txt &&
884 echo content6 >foo1.txt &&
885 echo content6 >bar1.txt &&
887 test_must_fail git rm bar1.txt foo1.txt 2>actual &&
888 test_i18ncmp expect actual
891 test_expect_success 'rm empty string should fail' '
892 test_must_fail git rm -rf ""