summaryrefslogtreecommitdiff
path: root/t/t7002-grep.sh
diff options
context:
space:
mode:
authorClemens Buchacher <drizzd@aon.at>2009-09-05 12:31:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-09-07 22:03:04 (GMT)
commit493b7a08d80535def6756b281873e4e0937ba6c2 (patch)
tree43d63705e1e0e3951e7c3acc61a89e2c96bcf518 /t/t7002-grep.sh
parent929e37d3dfef13895ef6e4b54c7d45962b234461 (diff)
downloadgit-493b7a08d80535def6756b281873e4e0937ba6c2.zip
git-493b7a08d80535def6756b281873e4e0937ba6c2.tar.gz
git-493b7a08d80535def6756b281873e4e0937ba6c2.tar.bz2
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 <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7002-grep.sh')
-rwxr-xr-xt/t7002-grep.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh
index 7868af8..fe87834 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