2013-06-25 15:53:56 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='git clean -i basic tests'
|
|
|
|
|
2023-02-06 23:07:40 +00:00
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
2013-06-25 15:53:56 +00:00
|
|
|
. ./test-lib.sh
|
2017-10-03 13:44:58 +00:00
|
|
|
. "$TEST_DIRECTORY"/lib-terminal.sh
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
test_expect_success 'setup' '
|
|
|
|
|
|
|
|
mkdir -p src &&
|
|
|
|
touch src/part1.c Makefile &&
|
|
|
|
echo build >.gitignore &&
|
|
|
|
echo \*.o >>.gitignore &&
|
|
|
|
git add . &&
|
|
|
|
git commit -m setup &&
|
|
|
|
touch src/part2.c README &&
|
|
|
|
git add .
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2013-07-24 02:22:04 +00:00
|
|
|
test_expect_success 'git clean -i (c: clean hotkey)' '
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
|
|
|
echo c | git clean -i &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_missing a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_missing src/part3.c &&
|
|
|
|
test_path_is_missing src/part3.h &&
|
|
|
|
test_path_is_missing src/part4.c &&
|
|
|
|
test_path_is_missing src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2013-07-24 02:22:04 +00:00
|
|
|
test_expect_success 'git clean -i (cl: clean prefix)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
|
|
|
echo cl | git clean -i &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_missing a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_missing src/part3.c &&
|
|
|
|
test_path_is_missing src/part3.h &&
|
|
|
|
test_path_is_missing src/part4.c &&
|
|
|
|
test_path_is_missing src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-07-24 02:22:04 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2013-06-25 15:53:56 +00:00
|
|
|
test_expect_success 'git clean -i (quit)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2013-07-24 02:22:04 +00:00
|
|
|
echo quit | git clean -i &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_file a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_file src/part3.c &&
|
|
|
|
test_path_is_file src/part3.h &&
|
|
|
|
test_path_is_file src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -i (Ctrl+D)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
|
|
|
echo "\04" | git clean -i &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_file a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_file src/part3.c &&
|
|
|
|
test_path_is_file src/part3.h &&
|
|
|
|
test_path_is_file src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id (filter all)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines f "*" "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_file a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_file src/part3.c &&
|
|
|
|
test_path_is_file src/part3.h &&
|
|
|
|
test_path_is_file src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id (filter patterns)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines f "part3.* *.out" "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_file a.out &&
|
|
|
|
test_path_is_missing docs/manual.txt &&
|
|
|
|
test_path_is_file src/part3.c &&
|
|
|
|
test_path_is_file src/part3.h &&
|
|
|
|
test_path_is_missing src/part4.c &&
|
|
|
|
test_path_is_missing src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id (filter patterns 2)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines f "* !*.out" "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_missing a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_file src/part3.c &&
|
|
|
|
test_path_is_file src/part3.h &&
|
|
|
|
test_path_is_file src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id (select - all)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines s "*" "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_missing a.out &&
|
|
|
|
test_path_is_missing docs/manual.txt &&
|
|
|
|
test_path_is_missing src/part3.c &&
|
|
|
|
test_path_is_missing src/part3.h &&
|
|
|
|
test_path_is_missing src/part4.c &&
|
|
|
|
test_path_is_missing src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id (select - none)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines s "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_file a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_file src/part3.c &&
|
|
|
|
test_path_is_file src/part3.h &&
|
|
|
|
test_path_is_file src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id (select - number)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines s 3 "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_file a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_missing src/part3.c &&
|
|
|
|
test_path_is_file src/part3.h &&
|
|
|
|
test_path_is_file src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id (select - number 2)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines s "2 3" 5 "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_file a.out &&
|
|
|
|
test_path_is_missing docs/manual.txt &&
|
|
|
|
test_path_is_missing src/part3.c &&
|
|
|
|
test_path_is_file src/part3.h &&
|
|
|
|
test_path_is_missing src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id (select - number 3)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines s "3,4 5" "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_file a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_missing src/part3.c &&
|
|
|
|
test_path_is_missing src/part3.h &&
|
|
|
|
test_path_is_missing src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2013-07-24 02:22:04 +00:00
|
|
|
test_expect_success 'git clean -id (select - filenames)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out foo.txt bar.txt baz.txt &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines s "a.out fo ba bar" "" c |
|
2013-07-24 02:22:04 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_missing a.out &&
|
|
|
|
test_path_is_missing foo.txt &&
|
|
|
|
test_path_is_missing bar.txt &&
|
|
|
|
test_path_is_file baz.txt &&
|
2013-07-24 02:22:04 +00:00
|
|
|
rm baz.txt
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2013-06-25 15:53:56 +00:00
|
|
|
test_expect_success 'git clean -id (select - range)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines s "1,3-4" 2 "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_missing a.out &&
|
|
|
|
test_path_is_missing src/part3.c &&
|
|
|
|
test_path_is_missing src/part3.h &&
|
|
|
|
test_path_is_file src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_missing docs/manual.txt &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id (select - range 2)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines s "4- 1" "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_missing a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_file src/part3.c &&
|
|
|
|
test_path_is_missing src/part3.h &&
|
|
|
|
test_path_is_missing src/part4.c &&
|
|
|
|
test_path_is_missing src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id (inverse select)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines s "*" "-5- 1 -2" "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_missing a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_missing src/part3.c &&
|
|
|
|
test_path_is_missing src/part3.h &&
|
|
|
|
test_path_is_file src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id (ask)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines a Y y no yes bad "" |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_missing a.out &&
|
|
|
|
test_path_is_missing docs/manual.txt &&
|
|
|
|
test_path_is_file src/part3.c &&
|
|
|
|
test_path_is_missing src/part3.h &&
|
|
|
|
test_path_is_file src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id (ask - Ctrl+D)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
test_write_lines a Y no yes "\04" |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_missing a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_missing src/part3.c &&
|
|
|
|
test_path_is_file src/part3.h &&
|
|
|
|
test_path_is_file src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id with prefix and path (filter)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
(cd build/ &&
|
|
|
|
test_write_lines f docs "*.h" "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id ..) &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_missing a.out &&
|
|
|
|
test_path_is_file docs/manual.txt &&
|
|
|
|
test_path_is_missing src/part3.c &&
|
|
|
|
test_path_is_file src/part3.h &&
|
|
|
|
test_path_is_missing src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id with prefix and path (select by name)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
(cd build/ &&
|
|
|
|
test_write_lines s ../docs/ ../src/part3.c ../src/part4.c "" c |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id ..) &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_file a.out &&
|
|
|
|
test_path_is_missing docs/manual.txt &&
|
|
|
|
test_path_is_missing src/part3.c &&
|
|
|
|
test_path_is_file src/part3.h &&
|
|
|
|
test_path_is_missing src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'git clean -id with prefix and path (ask)' '
|
|
|
|
|
|
|
|
mkdir -p build docs &&
|
|
|
|
touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
|
|
|
|
docs/manual.txt obj.o build/lib.so &&
|
2018-07-02 00:23:42 +00:00
|
|
|
(cd build/ &&
|
|
|
|
test_write_lines a Y y no yes bad "" |
|
2013-06-25 15:53:56 +00:00
|
|
|
git clean -id ..) &&
|
2024-03-04 17:17:32 +00:00
|
|
|
test_path_is_file Makefile &&
|
|
|
|
test_path_is_file README &&
|
|
|
|
test_path_is_file src/part1.c &&
|
|
|
|
test_path_is_file src/part2.c &&
|
|
|
|
test_path_is_missing a.out &&
|
|
|
|
test_path_is_missing docs/manual.txt &&
|
|
|
|
test_path_is_file src/part3.c &&
|
|
|
|
test_path_is_missing src/part3.h &&
|
|
|
|
test_path_is_file src/part4.c &&
|
|
|
|
test_path_is_file src/part4.h &&
|
|
|
|
test_path_is_file obj.o &&
|
|
|
|
test_path_is_file build/lib.so
|
2013-06-25 15:53:56 +00:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2017-10-03 13:44:58 +00:00
|
|
|
test_expect_success TTY 'git clean -i paints the header in HEADER color' '
|
2017-07-14 15:38:09 +00:00
|
|
|
>a.out &&
|
|
|
|
echo q |
|
2017-10-04 03:03:05 +00:00
|
|
|
test_terminal git clean -i |
|
2017-07-14 15:38:09 +00:00
|
|
|
test_decode_color |
|
|
|
|
head -n 1 >header &&
|
|
|
|
# not i18ngrep
|
|
|
|
grep "^<BOLD>" header
|
|
|
|
'
|
|
|
|
|
2013-06-25 15:53:56 +00:00
|
|
|
test_done
|