summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7fce6e3)
raw | patch | inline | side by side (parent: 7fce6e3)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Wed, 30 Dec 2009 14:11:44 +0000 (21:11 +0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 31 Dec 2009 07:10:53 +0000 (23:10 -0800) |
Skip-worktree entries are not on disk. We cannot use external grep in such
cases.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cases.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-grep.c | patch | blob | history |
diff --git a/builtin-grep.c b/builtin-grep.c
index 813fe9778ae443edafac338d67299368631e821d..25ee75d989d80382e370b5460f3d8f64ae086f6e 100644 (file)
--- a/builtin-grep.c
+++ b/builtin-grep.c
strbuf_setlen(sb, sb->len - 1);
}
+static int has_skip_worktree_entry(struct grep_opt *opt, const char **paths)
+{
+ int nr;
+ for (nr = 0; nr < active_nr; nr++) {
+ struct cache_entry *ce = active_cache[nr];
+ if (!S_ISREG(ce->ce_mode))
+ continue;
+ if (!pathspec_matches(paths, ce->name, opt->max_depth))
+ continue;
+ if (ce_skip_worktree(ce))
+ return 1;
+ }
+ return 0;
+}
+
static int external_grep(struct grep_opt *opt, const char **paths, int cached)
{
int i, nr, argc, hit, len, status;
char *argptr = randarg;
struct grep_pat *p;
- if (opt->extended || (opt->relative && opt->prefix_length))
+ if (opt->extended || (opt->relative && opt->prefix_length)
+ || has_skip_worktree_entry(opt, paths))
return -1;
len = nr = 0;
push_arg("grep");