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

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

From
Petr Onderka <gsvick@gmail.com>
Date
Aug 16, 2010, 16:51 UTC
Message-ID
<AANLkTi=2tRjGicxJxnJ3xccCGxcP3bLUy8u0O7q85D=R@mail.gmail.com>
In-Reply-To
<7vzkwsvllz.fsf@alter.siamese.dyndns.org>
Hi,
On Thu, Aug 12, 2010 at 00:19, Junio C Hamano <gitster@pobox.com> wrote:
Show 25 quoted lines
> Have you read the comment at the top of prepare-attr-stack?  This patch
> feels triply wrong:
>
>  - The attribute stack is arranged to have higher precedence file near the
>   top ($GIT_DIR/info/attributes used to be the highest).  The above
>   addition means that ~/.gitattributes from user's home trumps what is in
>   a particular repository.  That is backwards.  You may work on more than
>   one projects and have more than one repositories.  What you share among
>   them personally will go to ~/.gitattributes, while a setting specific
>   to a particular repository goes to $GIT_DIR/info/attributes and the
>   latter needs to be able to override the former.
>
>  - Same thing for git_attr_system() being at the end, which means you set
>   up your own $GIT_DIR/info/attributes (or ~/.gitattributes) carefully
>   but that can be broken by a selfish sysadmin who puts stuff that is
>   only useful to him in /etc/gitattributes, which is not what you want.
>
>  - Whenever we enter a new directory (either recursing into, or coming
>   back up), prepare_attr_stack() is called to pop the attributes records
>   from now-exited directories and push the attributes records from
>   directories we are about to descend into.  The current code knows that
>   the topmost element on the stack is special ($GIT_DIR/info/attributes)
>   and first pops it, adjust the stack for elements that came from the
>   directory hierarcy, and then pushes that back.  I don't see any code in
>   the patch to do the equivalent for these two new attribute sources.

Yeah, I realize now that I got the precedence wrong, the corrected patch is in the following email.

But to your third point, I read the comment and the code worked, because I put all the attributes from the 3 files into one attr_stack struct (the one at the top of the stack). That's why I changed read_attr_from_file too. Of course this is irrelevant now that those attributes will be at the bottom of the stack.

Petr Onderka
Previous: Junio C HamanoNext: Petr Onderka
Message 6 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.