summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-01-04 12:34:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-07 02:29:23 (GMT)
commit8740773ee5ef450cefd03d3576f348fe65e92edf (patch)
treea6606aed73f82fe655142f52f30580dc7ad206d6
parentcd83ac4156a211e019b47fa58de0784cee547ddf (diff)
downloadgit-8740773ee5ef450cefd03d3576f348fe65e92edf.zip
git-8740773ee5ef450cefd03d3576f348fe65e92edf.tar.gz
git-8740773ee5ef450cefd03d3576f348fe65e92edf.tar.bz2
t7002: test for not using external grep on skip-worktree paths
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin-grep.c1
-rwxr-xr-xt/t7002-grep.sh12
2 files changed, 13 insertions, 0 deletions
diff --git a/builtin-grep.c b/builtin-grep.c
index 25ee75d..04ac60a 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 23eeb76..99142fd 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