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

Re: [PATCH] attr: a note about the order of .gitattributes lookup

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 10, 2012, 18:04 UTC
Message-ID
<7vd30qcifj.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20121010135552.GA11293@do>
Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
Show 30 quoted lines
> This is the documentation part of
>
> 1a9d7e9 (attr.c: read .gitattributes from index as well. - 2007-08-14)
> 06f33c1 (Read attributes from the index that is being checked out - 2009-03-13)
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  I looked around but did not see anywhere mentioning this. If I did
>  not miss anything, then we should take a note about this to avoid
>  surprises.
>
>  Resend, this time git@vger is CCed. Sorry for the noise.
>
>  Documentation/gitattributes.txt | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
> index 99ed04d..8c52a99 100644
> --- a/Documentation/gitattributes.txt
> +++ b/Documentation/gitattributes.txt
> @@ -66,6 +66,12 @@ is from the path in question, the lower its precedence). Finally
>  global and system-wide files are considered (they have the lowest
>  precedence).
>  
> +Normally if `.gitattributes` is not found in a directory in work tree,
> +the same path in the index is examined. If there's a `.gitattributes`
> +version in the index, that version will be used. During checkout process,
> +the order of examination is reversed: index version is preferred over
> +the work tree version.
> +

Yeah, thanks for writing it up. The "direction" fix was done to help people when they check out a commit when a different commit with different .gitattributes is checked out to the working tree.

>  If you wish to affect only a single repository (i.e., to assign
>  attributes to files that are particular to
>  one user's workflow for that repository), then
Previous: Nguyen Thai Ngoc Duy
Message 2 of 2 in “attr: a note about the order of .gitattributes lookup”
  1. attr: a note about the order of .gitattributes lookupNguyen Thai Ngoc Duy, Oct 10, 2012
  2. Junio C HamanoOct 10, 2012

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.