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

Re: [PATCH/RFC] Add global and system-wide gitattributes

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Aug 11, 2010, 12:31 UTC
Message-ID
<vpq39uluy97.fsf@bauges.imag.fr>
In-Reply-To
<1281488646-7108-1-git-send-email-gsvick@gmail.com>
Petr Onderka <gsvick@gmail.com> writes:
> Allow gitattributes to be set globally and system wide in ~/.giattributes
> and $(prefix)/etc/gitattributes files, respectively. This way, settings
> for particular file types can be set in one place and apply for all user's
> repositories.

The feature is definitely useful, and I'll use it as soon as it gets into git.git ;-).

One point: we need to make sure the choice for the the user-wide filename is the right one, since it's a pain to change it later.

We already have ~/.gitconfig, which often points to ~/.gitexcludes or ~/.gitignored (but this filename is specified with a config variable, for which we didn't manage to agree on a default value). We're about to add ~/.gitattributes. That makes 3 ~/.git* files, and I think it's time to make it a directory (similar to $GIT_DIR/info/)

I think it should be done like this:
1) Default core.excludesfile to $CONF/exclude
2) Make your user-wide gitattribute $CONF/attributes
3) Optionally, read $CONF/config as well as ~/.gitconfig so that
   people can have all their git configuration in the same directory.
Now, we need to agree on $CONF. Some non-options are:
* CONF=~/.gitconfig would clash with the file ~/.gitconfig
* CONF=~/.git would prevent people from versionning their $HOME.

I'd be in favor of following the freedesktop standard (roughly, defaulting to ~/.config/git):

  http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

because other applications start using it, and it allows one to easily keep the configuration in a (typically git-versionned) ~/.config directory. And if we are to choose a config directory, it doesn't harm to chose one consistant with other applications and with a standard.

I never got time to implement this. If you're willing to do something like that, that would be great. If not, I'd suggest having a config variable to point to the user-wide gitattributes file (without a default value), because it allows a future transition by giving a default value to the variable.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Petr OnderkaNext: Junio C Hamano
Message 4 of 36 in “Add global and system-wide gitattributes”
  1. Add global and system-wide gitattributesPetr Onderka, Aug 11, 2010
  2. Henrik GrubbströmAug 11, 2010
  3. Petr OnderkaAug 11, 2010
  4. Matthieu MoyAug 11, 2010
  5. Junio C HamanoAug 11, 2010
  6. Petr OnderkaAug 16, 2010
  7. Add global and system-wide gitattributesPetr Onderka, Aug 16, 2010
  8. Štěpán NěmecAug 25, 2010
  9. Matthieu MoyAug 28, 2010
  10. Junio C HamanoAug 30, 2010
  11. Štěpán NěmecAug 30, 2010
  12. Matthieu MoyAug 28, 2010
  13. core.attributesfile: a fix, a simplification, and a testMatthieu Moy, Aug 28, 2010
  14. Štěpán NěmecAug 29, 2010
  15. Junio C HamanoAug 30, 2010
  16. Matthieu MoyAug 30, 2010
  17. Junio C HamanoAug 30, 2010
  18. Junio C HamanoAug 30, 2010
  19. Matthieu MoyAug 30, 2010
  20. 1/3 tests: factor HOME=$(pwd) in test-lib.shMatthieu Moy, Aug 30, 2010
  21. Ævar Arnfjörð BjarmasonAug 31, 2010
  22. Ævar Arnfjörð BjarmasonSep 1, 2010
  23. Junio C HamanoSep 1, 2010
  24. Ævar Arnfjörð BjarmasonSep 1, 2010
  25. Matthieu MoySep 1, 2010
  26. 2/3 don't write to git_log_output_encoding outside git_config()Matthieu Moy, Aug 30, 2010
  27. Matthieu MoySep 2, 2010
  28. Junio C HamanoSep 2, 2010
  29. 3/3 Add global and system-wide gitattributesMatthieu Moy, Aug 30, 2010
  30. Matthieu MoyAug 31, 2010
  31. Add global and system-wide gitattributesMatthieu Moy, Aug 31, 2010
  32. Junio C HamanoAug 31, 2010
  33. tests: factor HOME=$(pwd) in test-lib.shMatthieu Moy, Aug 30, 2010
  34. Ævar Arnfjörð BjarmasonAug 30, 2010
  35. Matthieu MoyAug 30, 2010
  36. Ævar Arnfjörð BjarmasonAug 30, 2010

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.