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

Re: Wrong gitignore precedence?

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 22, 2015, 18:59 UTC
Message-ID
<xmqqh9s8dm6f.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20150422150558.6326cb6152a306f028fb6ad3@gmail.com>
Yohei Endo <yoheie@gmail.com> writes:
Show 6 quoted lines
> I read the document of gitignore (http://git-scm.com/docs/gitignore),
> and learned that $GIT_DIR/info/exclude has higher precedence than
> the file specified by core.excludesfile.
>
> But I noticed that patterns in core.excludesfile override patterns in
> $GIT_DIR/info/exclude.

I tend to agree that info/exclude which is per-repository personal preference should take precedence over $XDG_HOME/git/ignore which is a personal preference across repositories that are accessed from that machine.

It appears that the precedence was screwed-up between these two files from the very beginning when 896bdfa2 (add: Support specifying an excludes file with a configuration variable, 2007-02-27) introduced core.excludesfile variable; seeing that nobody so far complained with the discrepancy between the documentation and the behaviour, it would indicate either (1) nobody reads the docs, or (2) nobody uses both at the same time.

Swapping the order in the code this late in the game after 8 years may affect people who have come to rely on the current behaviour and never read the doc, which is somewhat worrying, though.

Previous: Yohei EndoNext: Yohei Endo
Message 2 of 4 in “Wrong gitignore precedence?”
  1. Yohei EndoApr 22, 2015
  2. Junio C HamanoApr 22, 2015
  3. Yohei EndoApr 23, 2015
  4. ignore: info/exclude should trump core.excludesfileJunio C Hamano, Apr 22, 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.