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

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

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Feb 8, 2014, 08:10 UTC
Message-ID
<1391847004-22810-1-git-send-email-pclouds@gmail.com>

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 I won't optimize it until I see someone shows me they have a use case for it.

(*) either that or my coworkers keep pissing me off on purpose when
    they never clean trailing spaces.
Nguyễn Thái Ngọc Duy (2):
  dir: warn about trailing spaces in exclude pattern
  dir: ignore trailing spaces in exclude patterns
 Documentation/gitignore.txt | 3 +++
 dir.c                       | 9 +++++++++
 2 files changed, 12 insertions(+)
-- 
1.8.5.2.240.g8478abd
Next: Nguyễn Thái Ngọc Duy
Message 1 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.