From 493b7a08d80535def6756b281873e4e0937ba6c2 Mon Sep 17 00:00:00 2001 From: Clemens Buchacher Date: Sat, 5 Sep 2009 14:31:17 +0200 Subject: grep: accept relative paths outside current working directory "git grep" would barf at relative paths pointing outside the current working directory (or subdirectories thereof). Use quote_path_relative(), which can handle such cases just fine. [jc: added tests.] Signed-off-by: Clemens Buchacher Signed-off-by: Junio C Hamano --- t/t7002-grep.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 't') diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index 7868af8f1..fe87834fb 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -212,4 +212,21 @@ test_expect_success 'grep with CE_VALID file' ' git checkout t/t ' +test_expect_success 'grep from a subdirectory to search wider area (1)' ' + mkdir -p s && + ( + cd s && git grep "x x x" .. + ) +' + +test_expect_success 'grep from a subdirectory to search wider area (2)' ' + mkdir -p s && + ( + cd s || exit 1 + ( git grep xxyyzz .. >out ; echo $? >status ) + ! test -s out && + test 1 = $(cat status) + ) +' + test_done -- cgit v1.2.1