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

Re: .gittattributes handling has deficiencies

From
Steffen Prohaska <prohaska@zib.de>
Date
Oct 22, 2007, 13:04 UTC
Message-ID
<A524F676-BFFD-4AA7-8683-9623F12D2F2D@zib.de>
In-Reply-To
<Pine.LNX.4.64.0710221125350.25221@racer.site>
On Oct 22, 2007, at 12:29 PM, Johannes Schindelin wrote:
Show 24 quoted lines
>
> On Mon, 22 Oct 2007, Steffen Prohaska wrote:
>
>> .gitattributes is first looked for in the working directory, and  
>> if not
>> there, .gitattributes is read from the index.
>
> Of course we could change that to do it the other way round.  But this
> would contradict expectations when you edit .gitattributes and then
> checkout single files without having git-add'ed .gitattributes first.
>
> The biggest problem in your setup, however, is not  
> if .gitattributes is
> read from the index or the working directory.  The biggest problem  
> is that
> files are not touched when their contents have not changed.
>
> IOW if you have .gitattributes in the to-be-checked-out branch  
> which say
> that README is crlf, and in the current branch it is not, and README's
> _contents_ are identical in both branches, a "git checkout
> <that-other-branch>" will not rewrite README, and consequently not  
> change
> the working copy to crlf.

Exactly. The order of reading .gitattributes from the working directory or the index doesn't matter. The current mechanism has a more fundamental deficiency.

Changes of.gitattributes can influence how the same content is checked out to the work tree. If .gitattributes change the checkout may need to be updated, even if the real content did not change.

	Steffen
Previous: Johannes Schindelin
Message 14 of 14 in “.gittattributes handling has deficiencies”
  1. Steffen ProhaskaOct 21, 2007
  2. david@lang.hmOct 21, 2007
  3. Steffen ProhaskaOct 21, 2007
  4. david@lang.hmOct 21, 2007
  5. Steffen ProhaskaOct 21, 2007
  6. david@lang.hmOct 21, 2007
  7. Steffen ProhaskaOct 21, 2007
  8. david@lang.hmOct 21, 2007
  9. david@lang.hmOct 22, 2007
  10. Steffen ProhaskaOct 22, 2007
  11. Shawn O. PearceOct 22, 2007
  12. Steffen ProhaskaOct 22, 2007
  13. Johannes SchindelinOct 22, 2007
  14. Steffen ProhaskaOct 22, 2007

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.