From 8740773ee5ef450cefd03d3576f348fe65e92edf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Mon, 4 Jan 2010 19:34:15 +0700 Subject: [PATCH] t7002: test for not using external grep on skip-worktree paths MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin-grep.c | 1 + t/t7002-grep.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/builtin-grep.c b/builtin-grep.c index 25ee75d98..04ac60a29 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -232,6 +232,7 @@ static int exec_grep(int argc, const char **argv) int status; argv[argc] = NULL; + trace_argv_printf(argv, "trace: grep:"); pid = fork(); if (pid < 0) return pid; diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index 23eeb767f..99142fd6b 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 -- 2.26.2