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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 28, 2007 at 09:49:47 +0100, Johannes Schindelin wrote:
> Hi,
> 
> On Mon, 27 Aug 2007, Dmitry Kakurin wrote:
> 
> > Here is the problem: we need to apply crlf attributes to a file. We
> > could have .gitattributes both in the index and in the worktree.
> > Which one do we use?
> > In general .gitattributes file could be (U)nchanged, (C)hanged, (NP)
> > NotPresent in each place.
> 
> I do not see these cases.  You can have these cases, basically:
> 
> - .gitattributes in worktree (then it does not matter what else we have),
> - .gitattributes not in the worktree, but in the index (then that is taken)
> 
> In the latter case, there could be conflicts _in_ .gitattributes, in which 
> case those .gitattributes are ignored.
> 
> I do not see any problem with that.

I do.

IMNSHO it should be the other way around:
 .gitattributes in index, than index version is used.
 .gitattributes not in index, but in worktree, than that tree version is used.

Why? Because when you check out another version, the .gitattributes commited
in that version need to be applied, since it might be different from whatever
is currently in the tree.

In the other direction, the tree version seems to make more sense, but in
reality it does not. If you do a partial commit of a single file, than the
index version gets into the commit, so that should better be the version used
to store the file. On the other hand if you change .gitattributes, the normal
commit rules are that you need to add it for commit, so needing to add it to
make it effective goes well together with it. update-index would need to
always handle .git* before other entries to make add . and commit -a work
correctly.

The case for worktree only is for cases when you for some reason want to have
local .gitattributes. Though I am not sure that should actually work, because
you couldn't have local .gitattributes if there is versioned version.
.git/info/attributes would be better for that. Which gets us back to "always
use .gitattributes from *index*" (and read it from tree before other files
when adding it).

-- 
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux