Git Mailing List Archive on lore.kernel.org
 help / color / Atom feed
* git-grep in sparse checkout
@ 2019-10-01 13:06 Matheus Tavares Bernardino
  2019-10-01 13:30 ` Bert Wesarg
  2019-10-01 18:29 ` Derrick Stolee
  0 siblings, 2 replies; 9+ messages in thread
From: Matheus Tavares Bernardino @ 2019-10-01 13:06 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Derrick Stolee, Elijah Newren, Taylor Blau

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.

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

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

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 13:06 git-grep in sparse checkout Matheus Tavares Bernardino
2019-10-01 13:30 ` Bert Wesarg
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

Git Mailing List Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/git/0 git/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 git git/ https://lore.kernel.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.git


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git