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

Re: [PATCH] git.el: handle default excludesfile properly

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 4, 2018, 02:12 UTC
Message-ID
<CAPig+cTyZAFx486Y9LrQuaK0qMnQEGD3U55sk9Vvyb_TgDz5tQ@mail.gmail.com>
In-Reply-To
<CAE09B1+XXJvrOucHwehUGk=Taio7sirfOh5gq7KGs4iZSpK=vQ@mail.gmail.com>
On Sat, Mar 3, 2018 at 8:36 PM, Dorab Patel <dorabpatel@gmail.com> wrote:
Show 6 quoted lines
> Correct me if I'm wrong, but my understanding, from
> https://git-scm.com/docs/gitignore, is that $HOME/.gitignore is used
> only if it is specified as the value of core.excludesfile in
> ~/.gitconfig. It is not used by default. If that is so, then the
> proposed (and original) code works. The changes I am proposing handle
> the default case, when core.excludesfile is not specified.

You're right. I must have set core.excludesfile so long ago that I forgot about it and assumed $HOME/.gitignore was consulted by default.

Show 10 quoted lines
> Looking deeper into how the function git-get-exclude-files is used, I
> see that it is only being called from git-run-ls-files-with-excludes.
> So, perhaps, a better (or additional) fix might be to add the
> parameter "--exclude-standard" in the call to git-run-ls-files from
> within git-run-ls-files-with-excludes. And remove the need for
> get-get-exclude-files altogether.  Presumably, "--exclude-standard"
> handles the default case with/without XDG_CONFIG_HOME correctly. The
> question I'd have then is: why didn't the original author use that
> option? Either I'm missing something? Or the option was added later,
> after the original code was written? Or something else?

Using --exclude-standard rather than --exclude-from and retiring git-get-exclude-files() makes sense to me.

As for why the original author didn't use --exclude-standard, project history tells us that. In particular, git-get-exclude-files() was implemented by 274e13e0e9 (git.el: Take into account the core.excludesfile config option., 2007-07-31), whereas --exclude-standard was introduced by 8e7b07c8a7 (git-ls-files: add --exclude-standard, 2007-11-15), three and a half months later.

If you do re-roll to use --exclude-standard, then it would be good for your commit message to explain this history, citing the relevant commits.

Thanks.
Previous: Dorab PatelNext: Dorab Patel
Message 4 of 19 in “git.el: handle default excludesfile properly”
  1. git.el: handle default excludesfile properlyDorab Patel, Mar 3, 2018
  2. Eric SunshineMar 3, 2018
  3. Dorab PatelMar 4, 2018
  4. Eric SunshineMar 4, 2018
  5. Dorab PatelMar 4, 2018
  6. Eric SunshineMar 4, 2018
  7. Junio C HamanoMar 5, 2018
  8. Alexandre JulliardMar 6, 2018
  9. Dorab PatelMar 7, 2018
  10. Ævar Arnfjörð BjarmasonMar 8, 2018
  11. git{,-blame}.el: remove old bitrotting Emacs codeÆvar Arnfjörð Bjarmason, Mar 8, 2018
  12. Junio C HamanoMar 8, 2018
  13. git{,-blame}.el: remove old bitrotting Emacs codeÆvar Arnfjörð Bjarmason, Mar 10, 2018
  14. Martin ÅgrenMar 10, 2018
  15. Junio C HamanoMar 13, 2018
  16. Ævar Arnfjörð BjarmasonMar 13, 2018
  17. Junio C HamanoMar 13, 2018
  18. Kyle MeyerMar 8, 2018
  19. git.el: handle default excludesfile properlyDorab Patel, Mar 6, 2018

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.