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

Re: [PATCH 0/2] Ignore trailing spaces in .gitignore

From
Duy Nguyen <pclouds@gmail.com>
Date
Feb 10, 2014, 04:29 UTC
Message-ID
<CACsJy8AZbi89gsM_MWzPe+95y+MqjtFpiFZE8ai1JMtzwiLTQg@mail.gmail.com>
In-Reply-To
<7vd2iv8vbo.fsf@alter.siamese.dyndns.org>
On Mon, Feb 10, 2014 at 11:07 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 22 quoted lines
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> Trailing spaces are invisible in most standard editors (*). "git diff"
>> does show trailing spaces by default. But that does not help newly
>> written .gitignore files. And trailing spaces are the source of
>> frustration when writing .gitignore.
>>
>> So let's ignore them. Nobody sane would put a trailing space in file
>> names. But we could be careful and do it in two steps: warn first,
>> then ignore trailing spaces. Another option is merge two patches in
>> one and be done with it.
>>
>> People can still quote trailing spaces, which will not be ignored (and
>> much more visible). Quoting comes with a cost of doing fnmatch(). But
>
> Hmph, sorry but I fail to see why we need to incur cost for
> fnmatch().  We read and parse the file and keep them as internal
> strings, so your unquoting (and complaining the unquoted trailng
> spaces) can be done at the parse time, while keeping the trailing
> spaces the user explicitly told us to keep by quoting in the
> internal string that we eventually feed fnmatch() with _after_
> unquoting, no?

That's the optimization in the "but" sentence. Another (off topic) opt. we could do is make "*.[ch]" behave more like "*.c", where we just try to match the tail part.

-- 
Duy
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 13 in “Ignore trailing spaces in .gitignore”
  1. 0/2 Ignore trailing spaces in .gitignoreNguyễn Thái Ngọc Duy, Feb 8, 2014
  2. 1/2 dir: warn about trailing spaces in exclude patternNguyễn Thái Ngọc Duy, Feb 8, 2014
  3. Torsten BögershausenFeb 8, 2014
  4. 2/2 dir: ignore trailing spaces in exclude patternsNguyễn Thái Ngọc Duy, Feb 8, 2014
  5. Jeff KingFeb 8, 2014
  6. Duy NguyenFeb 8, 2014
  7. Jeff KingFeb 10, 2014
  8. 0/2 Ignore trailing spaces in .gitignoreNguyễn Thái Ngọc Duy, Feb 9, 2014
  9. 1/2 dir: warn about trailing spaces in exclude patternsNguyễn Thái Ngọc Duy, Feb 9, 2014
  10. 2/2 dir: ignore trailing spaces in exclude patternsNguyễn Thái Ngọc Duy, Feb 9, 2014
  11. Junio C HamanoFeb 10, 2014
  12. Duy NguyenFeb 10, 2014
  13. Junio C HamanoFeb 10, 2014

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.