@matheusbsbs / matheus-bagliano / commits / 8740773ee5
Fork 0

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>

Nguyễn Thái Ngọc Duy committed Jan 4, 2010 at 19:34 UTC 8740773ee5ef450cefd03d3576f348fe65e92edf
2 files changed +13
builtin-grep.c
+1
@@ -232,6 +232,7 @@ static int exec_grep(int argc, const char **argv)
232 int status;
233
234 argv[argc] = NULL;
235 + trace_argv_printf(argv, "trace: grep:");
236 pid = fork();
237 if (pid < 0)
238 return pid;
t/t7002-grep.sh
+12
@@ -340,4 +340,16 @@ test_expect_success 'grep -p -B5' '
340 test_cmp expected actual
341 '
342
343 +test_expect_success EXTGREP 'external grep is called' '
344 + GIT_TRACE=2 git grep foo >/dev/null 2>actual &&
345 + grep "trace: grep:.*foo" actual >/dev/null
346 +'
347 +
348 +test_expect_success EXTGREP 'no external grep when skip-worktree entries exist' '
349 + git update-index --skip-worktree file &&
350 + GIT_TRACE=2 git grep foo >/dev/null 2>actual &&
351 + ! grep "trace: grep:" actual >/dev/null &&
352 + git update-index --no-skip-worktree file
353 +'
354 +
355 test_done