All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx+git@kernel.org>
To: Ben Knoble <ben.knoble@gmail.com>
Cc: git@vger.kernel.org, Andy Shevchenko <andy@kernel.org>,
	 Linus Torvalds <torvalds@linux-foundation.org>,
	Krzysztof Kozlowski <krzk@kernel.org>
Subject: Re: git-ls-files(1) avoiding symlinks
Date: Fri, 6 Nov 2026 20:36:31 +0100	[thread overview]
Message-ID: <au4rmQRjRtIv1Oru@debian> (raw)
In-Reply-To: <AE63992D-7BEA-413D-A372-78708CFA8F6F@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1260 bytes --]

Hi Ben,

> Date: 2026-11-06 12:34:20-0500
> From: Ben Knoble <ben.knoble@gmail.com>
>
[...]
> > Hmmm, that could work.  Thanks!
> > 
> >    $ git ls-files --format='%(objectmode) %(path)' \
> >    | grep -v ^120000 \
> >    | sed 's/^.* //' \
> >    | grep '\.[ch]$' \
> >    | xargs grepc creat;
> > 
> > With -z it becomes a bit tedious:
> > 
> >    $ git ls-files -z --format='%(objectmode) %(path)' \
> >    | grep -zv ^120000 \
> >    | sed -z 's/^.* //' \
> >    | grep -z '\.[ch]$' \
> >    | xargs -0 grepc creat;
> 
> The filtering for C files can also be done by Git, I believe:
> 
>     git ls-files … '*.[ch]'

I prefer regexes over globs; they're more powerful, and they're hot in
brain memory.  :)

> > But, indeed, I don't care about files with spaces often, because I don't
> > create them in my stuff.
> > 
> > I expect git-ls-files(1) could make this much simpler, though:
> > 
> >    $ git ls-files --type f \
> >    | grep '\.[ch]$' \
> >    | xargs grepc creat;
> 
> I believe the expression is “patches [scratching your own itch are] welcome” ;) 

Nice!  If the idea is welcome, I can certainly work on a patch.  :)


Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2026-11-06 19:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 13:35 git-ls-files(1) avoiding symlinks Alejandro Colomar
2026-11-06 14:15 ` D. Ben Knoble
2026-11-06 14:45   ` Alejandro Colomar
     [not found]     ` <AE63992D-7BEA-413D-A372-78708CFA8F6F@gmail.com>
2026-11-06 19:36       ` Alejandro Colomar [this message]
2026-11-06 20:16         ` Junio C Hamano
2026-11-06 21:06           ` Alejandro Colomar

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

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

  git send-email \
    --in-reply-to=au4rmQRjRtIv1Oru@debian \
    --to=alx+git@kernel.org \
    --cc=andy@kernel.org \
    --cc=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=krzk@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.