git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 10/16] grep: skip files that have not been checked out
  2008-09-14 13:07                 ` [PATCH 09/16] ls-files: apply --deleted on narrow area only Nguyễn Thái Ngọc Duy
@ 2008-09-14 13:07                   ` Nguyễn Thái Ngọc Duy
  2008-09-14 18:56                     ` Jakub Narebski
  0 siblings, 1 reply; 3+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2008-09-14 13:07 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin-grep.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/builtin-grep.c b/builtin-grep.c
index 3a51662..d5507d7 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -343,6 +343,8 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
 			continue;
 		if (!pathspec_matches(paths, ce->name))
 			continue;
+		if (ce_no_checkout(ce))
+			continue;
 		name = ce->name;
 		if (name[0] == '-') {
 			int len = ce_namelen(ce);
@@ -404,8 +406,11 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached)
 				continue;
 			hit |= grep_sha1(opt, ce->sha1, ce->name, 0);
 		}
-		else
+		else {
+			if (ce_no_checkout(ce))
+				continue;
 			hit |= grep_file(opt, ce->name);
+		}
 		if (ce_stage(ce)) {
 			do {
 				nr++;
-- 
1.6.0.96.g2fad1.dirty

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 10/16] grep: skip files that have not been checked out
  2008-09-14 13:07                   ` [PATCH 10/16] grep: skip files that have not been checked out Nguyễn Thái Ngọc Duy
@ 2008-09-14 18:56                     ` Jakub Narebski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2008-09-14 18:56 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git

Nguyễn Thái Ngọc Duy    <pclouds@gmail.com> writes:

> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  builtin-grep.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)

No changes to Documentation/git-grep.txt?
-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 10/16] grep: skip files that have not been checked out
       [not found] <48cdd6cb7415e_3c273fa85e999d2827466@app01.zenbe.com.tmail>
@ 2008-09-15  7:48 ` Jakub Narebski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2008-09-15  7:48 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: git

Duy Nguyen wrote:
> On 09/15/2008 "Jakub Narebski" <jnareb@gmail.com> wrote:
> >Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> > 
> > > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> > > ---
> > >  builtin-grep.c |    7 ++++++-
> > >  1 files changed, 6 insertions(+), 1 deletions(-)
> > 
> > No changes to Documentation/git-grep.txt?
> 
> No, "git grep" should only grep files in working directories. In
> narrow checkout mode, some files may be missing but current "git grep"
> does not know about that, hence this fix.  

Perhaps that should be stated explicitly, that git-grep searches only
[intentionally] checked-out files when searching working directory,
and only files without no-checkout bit set when searching index with
"git grep --cached".

P.S. I think it should be [--cached|<tree>...] in git-grep synopsis,
and not [--cached] ... [<tree>...], but that is unrelated thing, and
doesn't matter to you.
-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-09-15  7:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <48cdd6cb7415e_3c273fa85e999d2827466@app01.zenbe.com.tmail>
2008-09-15  7:48 ` [PATCH 10/16] grep: skip files that have not been checked out Jakub Narebski
2008-09-14 13:07 [PATCH 00/16] Narrow/Partial/Sparse checkout Nguyễn Thái Ngọc Duy
2008-09-14 13:07 ` [PATCH 01/16] Extend index to save more flags Nguyễn Thái Ngọc Duy
2008-09-14 13:07   ` [PATCH 02/16] Introduce CE_NO_CHECKOUT bit Nguyễn Thái Ngọc Duy
2008-09-14 13:07     ` [PATCH 03/16] update-index: refactor mark_valid() in preparation for new options Nguyễn Thái Ngọc Duy
2008-09-14 13:07       ` [PATCH 04/16] update-index: add --checkout/--no-checkout to update CE_NO_CHECKOUT bit Nguyễn Thái Ngọc Duy
2008-09-14 13:07         ` [PATCH 05/16] ls-files: add --narrow-checkout option to "will checkout" entries Nguyễn Thái Ngọc Duy
2008-09-14 13:07           ` [PATCH 06/16] Add tests for updating no-checkout entries in index Nguyễn Thái Ngọc Duy
2008-09-14 13:07             ` [PATCH 07/16] Prevent diff machinery from examining worktree outside narrow checkout Nguyễn Thái Ngọc Duy
2008-09-14 13:07               ` [PATCH 08/16] checkout_entry(): CE_NO_CHECKOUT on checked out entries Nguyễn Thái Ngọc Duy
2008-09-14 13:07                 ` [PATCH 09/16] ls-files: apply --deleted on narrow area only Nguyễn Thái Ngọc Duy
2008-09-14 13:07                   ` [PATCH 10/16] grep: skip files that have not been checked out Nguyễn Thái Ngọc Duy
2008-09-14 18:56                     ` Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).