From cd83ac4156a211e019b47fa58de0784cee547ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Mon, 4 Jan 2010 19:34:14 +0700 Subject: t7002: set test prerequisite "external-grep" if supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add another test to set prerequisite EXTGREP if the current build supports external grep. This can be used to skip external grep only tests on builds that do not support this optimization. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- t/t7002-grep.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 't/t7002-grep.sh') diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index b4709e28b5..23eeb767f9 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -8,6 +8,18 @@ test_description='git grep various. . ./test-lib.sh +test_expect_success 'Check for external grep support' ' + case "$(git grep -h 2>&1|grep ext-grep)" in + *"(default)"*) + test_set_prereq EXTGREP + true;; + *"(ignored by this build)"*) + true;; + *) + false;; + esac +' + cat >hello.c < int main(int argc, const char **argv) -- cgit v1.2.1 From 8740773ee5ef450cefd03d3576f348fe65e92edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Mon, 4 Jan 2010 19:34:15 +0700 Subject: t7002: test for not using external grep on skip-worktree paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- t/t7002-grep.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 't/t7002-grep.sh') diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index 23eeb767f9..99142fd6bd 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -340,4 +340,16 @@ test_expect_success 'grep -p -B5' ' test_cmp expected actual ' +test_expect_success EXTGREP 'external grep is called' ' + GIT_TRACE=2 git grep foo >/dev/null 2>actual && + grep "trace: grep:.*foo" actual >/dev/null +' + +test_expect_success EXTGREP 'no external grep when skip-worktree entries exist' ' + git update-index --skip-worktree file && + GIT_TRACE=2 git grep foo >/dev/null 2>actual && + ! grep "trace: grep:" actual >/dev/null && + git update-index --no-skip-worktree file +' + test_done -- cgit v1.2.1