public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* How to restrict command “git grep” to the first search result per file?
@ 2025-07-06 11:28 Markus Elfring
  2025-07-06 11:42 ` Andreas Schwab
  2025-07-06 13:27 ` Phillip Wood
  0 siblings, 2 replies; 5+ messages in thread
From: Markus Elfring @ 2025-07-06 11:28 UTC (permalink / raw)
  To: git

Hello,

File contents can be searched also by the means of the program call “git grep”.
Would you become interested to find specified items only once in each file
(instead of multiple times)?

Regards,
Markus

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

* Re: How to restrict command “git grep” to the first search result per file?
  2025-07-06 11:28 How to restrict command “git grep” to the first search result per file? Markus Elfring
@ 2025-07-06 11:42 ` Andreas Schwab
  2025-07-06 12:20   ` Markus Elfring
  2025-07-08  5:30   ` Markus Elfring
  2025-07-06 13:27 ` Phillip Wood
  1 sibling, 2 replies; 5+ messages in thread
From: Andreas Schwab @ 2025-07-06 11:42 UTC (permalink / raw)
  To: Markus Elfring; +Cc: git

On Jul 06 2025, Markus Elfring wrote:

> File contents can be searched also by the means of the program call “git grep”.
> Would you become interested to find specified items only once in each file
> (instead of multiple times)?

Does "git grep -l" suit your needs?

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

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

* Re: How to restrict command “git grep” to the first search result per file?
  2025-07-06 11:42 ` Andreas Schwab
@ 2025-07-06 12:20   ` Markus Elfring
  2025-07-08  5:30   ` Markus Elfring
  1 sibling, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2025-07-06 12:20 UTC (permalink / raw)
  To: Andreas Schwab, git

>> Would you become interested to find specified items only once in each file
>> (instead of multiple times)?
> 
> Does "git grep -l" suit your needs?
I imagine that it can occasionally matter see a bit more context for a search result
besides a file name.

Regards,
Markus

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

* Re: How to restrict command “git grep” to the first search result per file?
  2025-07-06 11:28 How to restrict command “git grep” to the first search result per file? Markus Elfring
  2025-07-06 11:42 ` Andreas Schwab
@ 2025-07-06 13:27 ` Phillip Wood
  1 sibling, 0 replies; 5+ messages in thread
From: Phillip Wood @ 2025-07-06 13:27 UTC (permalink / raw)
  To: Markus Elfring, git

Hi Markus

On 06/07/2025 12:28, Markus Elfring wrote:
> File contents can be searched also by the means of the program call “git grep”.
> Would you become interested to find specified items only once in each file
> (instead of multiple times)?

Looking at the man page for git grep there is a --max-count option which 
will limit the number of matches per file.

Thanks

Phillip

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

* Re: How to restrict command “git grep” to the first search result per file?
  2025-07-06 11:42 ` Andreas Schwab
  2025-07-06 12:20   ` Markus Elfring
@ 2025-07-08  5:30   ` Markus Elfring
  1 sibling, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2025-07-08  5:30 UTC (permalink / raw)
  To: Andreas Schwab, git

> Does "git grep -l" suit your needs?

Is it possible to determine such information also by a corresponding function
(instead of the mentioned program call interface)?

Would you occasionally like to transfer file details for search results
by other application programming interfaces?

Regards,
Markus

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

end of thread, other threads:[~2025-07-08  5:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-06 11:28 How to restrict command “git grep” to the first search result per file? Markus Elfring
2025-07-06 11:42 ` Andreas Schwab
2025-07-06 12:20   ` Markus Elfring
2025-07-08  5:30   ` Markus Elfring
2025-07-06 13:27 ` Phillip Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox