git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Matheus Tavares Bernardino <matheus.bernardino@usp.br>
Cc: git <git@vger.kernel.org>, Jeff King <peff@peff.net>,
	Derrick Stolee <dstolee@microsoft.com>,
	Elijah Newren <newren@gmail.com>, Taylor Blau <me@ttaylorr.com>
Subject: Re: git-grep in sparse checkout
Date: Tue, 1 Oct 2019 15:30:45 +0200	[thread overview]
Message-ID: <CAKPyHN3G-j6p8YZmk+07Sb3tL9vua_R-hJ=W81O7vCYr07AkxA@mail.gmail.com> (raw)
In-Reply-To: <CAHd-oW7e5qCuxZLBeVDq+Th3E+E4+P8=WzJfK8WcG2yz=n_nag@mail.gmail.com>

Hi,

On Tue, Oct 1, 2019 at 3:06 PM Matheus Tavares Bernardino
<matheus.bernardino@usp.br> wrote:
>
> Hi,
>
> During Git Summit it was mentioned that git-grep searches outside
> sparsity pattern which is not aligned with user expectation. I took a
> quick look at it and it seems the reason is
> builtin/grep.c:grep_cache() (which also greps worktree) will grep the
> object store when a given index entry has the CE_SKIP_WORKTREE bit
> turned on.
>

I also had once this problem and found that out and wrote a patch. I
was just about to send this patch out.

Btw, ls-files should also learn to skip worktree files.

Stay tuned.

Bert

> From what I understand, this bit is used exactly for sparse checkouts
> (as described in Documentation/technical/index-format.txt[1]). But
> should we perhaps ignore it in git-grep to have the expected behavior?
> I'll be happy to send the patch if so, but I wanted to check with you
> first.
>
> Grepping with --cached or in given trees objects would still grep
> outside the cone, but that is what one would expect, right? Or should
> we filter out what is outside of the cone for cached grep as well?
>
> Thanks,
> Matheus
>
> [1]: https://github.com/git/git/blob/master/Documentation/technical/index-format.txt#L101

  reply	other threads:[~2019-10-01 13:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01 13:06 git-grep in sparse checkout Matheus Tavares Bernardino
2019-10-01 13:30 ` Bert Wesarg [this message]
2019-10-01 16:12   ` Elijah Newren
2019-10-02  6:33     ` Junio C Hamano
2019-10-02 16:46       ` Elijah Newren
2019-10-01 18:29 ` Derrick Stolee
2019-10-02  0:06   ` Matheus Tavares Bernardino
2019-10-02  6:18   ` Junio C Hamano
2019-10-02 12:09     ` Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKPyHN3G-j6p8YZmk+07Sb3tL9vua_R-hJ=W81O7vCYr07AkxA@mail.gmail.com' \
    --to=bert.wesarg@googlemail.com \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=matheus.bernardino@usp.br \
    --cc=me@ttaylorr.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).