git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: multiple source file extensions

From
Eric Sunshine <sunshine@sunshineco.com>
Date
May 2, 2015, 07:11 UTC
Message-ID
<CAPig+cT8kP0NrmXXn-chBU+zjM_28NT5CVivda2NDs_mxuepzQ@mail.gmail.com>
In-Reply-To
<20150502023504.GC587@peff.net>
On Fri, May 1, 2015 at 10:35 PM, Jeff King <peff@peff.net> wrote:
Show 22 quoted lines
> On Sat, May 02, 2015 at 09:11:16AM +0700, Duy Nguyen wrote:
>> On Sat, May 2, 2015 at 9:04 AM, Duy Nguyen <pclouds@gmail.com> wrote:
>> > On Fri, May 01, 2015 at 09:11:01PM -0400, Jeff King wrote:
>> >> Unfortunately there is no way to use curly braces with git's pathspec,
>> >> so you have to write out three separate `*` arguments rather than using
>> >> the shell-style {cc,cpp,h}.
>> >
>> > Noted. Need to add curly brace support in pathspec :-)
>>
>> Naah people can just do
>>
>> git grep pattern -- '*'.{cc,cpp,h}
>>
>> and bash will take care of expanding it into three separate arguments.
>> Obscure, but pathspec is also obscure..
>
> Thanks, I had a vague notion that I should be able to convince the shell
> to do it for me, but of course "*.{cc,cpp,h}" doesn't work. I always
> forget about breaking up parameters into two parts with different
> quoting like this.
>
> I agree we don't really need curly braces in pathspecs. :)

However, neither POSIX shells nor the Windows command interpreter support curly-brace alternation.

Previous: Jeff KingNext: Junio C Hamano
Message 7 of 13 in “multiple source file extensions”
  1. Thiago FarinaMay 2, 2015
  2. Josh HaginsMay 2, 2015
  3. Jeff KingMay 2, 2015
  4. Duy NguyenMay 2, 2015
  5. Duy NguyenMay 2, 2015
  6. Jeff KingMay 2, 2015
  7. Eric SunshineMay 2, 2015
  8. Junio C HamanoMay 3, 2015
  9. Jeff KingMay 2, 2015
  10. Thiago FarinaMay 4, 2015
  11. Jeff KingMay 5, 2015
  12. Mikael MagnussonMay 5, 2015
  13. Jeff KingMay 5, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.