Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: .gitignore, .gitattributes, .gitmodules, .gitprecious?,.gitacls? etc.

From: Dmitry Kakurin <hidden>
Date: 2016-06-15 22:43:33

On 9/5/07, Junio C Hamano [off-list ref] wrote:
"Dmitry Kakurin" [off-list ref] writes:
quoted
I assert that since index does not have .gitattributes the one from
local directory should not be used.

Think about dedicated build machine scenario: I have a machine that
always does sync + build. After every sync the local directory should
always be identical to what-was-committed.
Thinking about the reason _why_ .gitattributes may be updated,
one would notice that it is because somebody did this command
sequence:

       git checkout            ;# now work tree is clean
       edit .gitattributes     ;# modify the attributes of a file
       edit file               ;# edit the file attributes talks about
       git add file            ;# this can be affected by .gitattributes
       git add .gitattributes  ;# this is changed in the same commit
       git commit

Now, should we always take .gitattributes from the index?
No, from couple of my emails back:
This leads to a simple idea that mostly works:
1. when files are moved from index to filesystem, then only .gitattributes in the index is used, if it's not there == no special attributes.
2. when files are moved from filesystem to index, then only .gitattributes in filesystem is used, again if it's not there == no special attributes.

Then, in any operation, only one .gitattributes is taken into account.
This is a must-do change (IMHO).

To go one step further (again IMHO) is to eliminate workspace version
of .gitattributes all together:
We could stop here, but to me this redundancy still has some room for confusion and looks unnecessary.
Plus there is still room for unintentional abuse (by mistake).
That's why I think it's a good idea to always have only one .gitattributes (in the index).
-- 
- Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help