diff options
author | Jiang Xin <worldhello.net@gmail.com> | 2013-07-24 10:22:04 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-07-24 19:16:51 -0700 |
commit | 60838613054f43d63086b0f4a7596baaee9e20c5 (patch) | |
tree | ca9eee2aafdbd902d54ec15b769d99c173630084 /t/t7301-clean-interactive.sh | |
parent | 309422e033bc2e25a3a80d1336993a75b7daaf33 (diff) | |
download | git-60838613054f43d63086b0f4a7596baaee9e20c5.tar.gz |
git-clean: implement partial matching for selection
Document for interactive git-clean says: "You also could say `c` or
`clean` above as long as the choice is unique". But it's not true,
because only hotkey `c` and full match (`clean`) could work.
Implement partial matching via find_unique function to make the
document right.
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7301-clean-interactive.sh')
-rwxr-xr-x | t/t7301-clean-interactive.sh | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/t/t7301-clean-interactive.sh b/t/t7301-clean-interactive.sh index 4e6055d06a..3ae394e934 100755 --- a/t/t7301-clean-interactive.sh +++ b/t/t7301-clean-interactive.sh @@ -17,7 +17,7 @@ test_expect_success 'setup' ' ' -test_expect_success 'git clean -i (clean)' ' +test_expect_success 'git clean -i (c: clean hotkey)' ' mkdir -p build docs && touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \ @@ -38,12 +38,33 @@ test_expect_success 'git clean -i (clean)' ' ' +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 && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test ! -f a.out && + test -f docs/manual.txt && + test ! -f src/part3.c && + test ! -f src/part3.h && + test ! -f src/part4.c && + test ! -f src/part4.h && + test -f obj.o && + test -f build/lib.so + +' + 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 && - echo q | git clean -i && + echo quit | git clean -i && test -f Makefile && test -f README && test -f src/part1.c && @@ -256,6 +277,21 @@ test_expect_success 'git clean -id (select - number 3)' ' ' +test_expect_success 'git clean -id (select - filenames)' ' + + mkdir -p build docs && + touch a.out foo.txt bar.txt baz.txt && + (echo s; echo a.out fo ba bar; echo; echo c) | \ + git clean -id && + test -f Makefile && + test ! -f a.out && + test ! -f foo.txt && + test ! -f bar.txt && + test -f baz.txt && + rm baz.txt + +' + test_expect_success 'git clean -id (select - range)' ' mkdir -p build docs && |