From ea0e7c7b250078ebcdcc45e68272e1e8d6600f40 Mon Sep 17 00:00:00 2001 From: Ingo Karkat Date: Sat, 3 Dec 2011 16:55:13 +0100 Subject: [PATCH] FIX: Correct quoting for negative -TERM filtering. This oversight was recently introduced with the new filtercommand() in a0f39480bfcf6f9de95583257cee958bcc7ef594. I've enhanced the test to cover -TERM filtering, too. --- tests/t1300-ls.sh | 23 +++++++++++++++++++++++ todo.sh | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/tests/t1300-ls.sh b/tests/t1300-ls.sh index 1112047..9493533 100755 --- a/tests/t1300-ls.sh +++ b/tests/t1300-ls.sh @@ -73,6 +73,29 @@ TODO: 1 of 3 tasks shown TODO: 1 of 3 tasks shown EOF +# +# check negative filtering via -TERM +# +test_todo_session 'checking negative filtering via -TERM' <>> todo.sh ls -second +2 aaa zzz this line should be first. +1 ccc xxx this line should be third. +-- +TODO: 2 of 3 tasks shown + +>>> todo.sh ls "-should be f" +3 bbb yyy this line should be second. +1 ccc xxx this line should be third. +-- +TODO: 2 of 3 tasks shown + +>>> todo.sh ls "- zzz" +3 bbb yyy this line should be second. +1 ccc xxx this line should be third. +-- +TODO: 2 of 3 tasks shown +EOF + # # check the filtering of TERM with regexp # diff --git a/todo.sh b/todo.sh index c2fa85c..a692dc6 100755 --- a/todo.sh +++ b/todo.sh @@ -688,7 +688,7 @@ filtercommand() ## $search_term # ## Remove the first character (-) before adding to our filter command - filter="${filter:-}${filter:+ | }grep -v -i '$(shellquote "${search_term:1}")'" + filter="${filter:-}${filter:+ | }grep -v -i $(shellquote "${search_term:1}")" fi done