Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] gitattributes

Marc Strapetz <marc.strapetz@xxxxxxxxxxx> wrote:
> >> Are there already some efforts to support new "text" and "eol"
> >> properties of .gitattributes?
> > 
> > Nope, nobody is working on it yet.
> My ultimate goal is that WorkingTreeIterator will honor "text" and
> "eol".

Right, that would be great to have.

> So our patch would probably consist of (1) general gitattributes
> parsing,

Yes, this should be simple as the file format is rather trivial
to parse.  We can do this as a class similar to Config.  For
gitattributes there are only 2 files if I recall, ".gitattributes"
in the top level directory and "GIT_DIR/info/attributes".  So we can
do something similar to Config where there is an optional default
instance to consult.

We should support loading attribute data from both local
filesystem and from blob, so we probably want to closely mirror
the Config structure to support an Attributes, FileBasedAttributes,
BlobBasedAttributes classes.

One thing to keep in mind is attribute files can have conflicts
in them, and still be usuable by Git, because they are strictly
single-line per record files.  So you need to safely ignore lines
like "<<<<", "====", ">>>>" to work around conflict hunk markers.
In terms of *editing* a FileBasedAttributes instance, we should
retain these markers.


Back to the top