New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for .gitattributes #53
Comments
And also there are tools like git-crypt that use gitattributes. |
That seems to rely on the smudge/clean filters. Perhaps we'll want to support those too. I haven't thought much about how to implement that or what consequences it would have. I also haven't yet checked when Git runs them. I specifically wonder if they're only used when checking out from the index to the working copy or if they're also used e.g. when doing operations in memory. |
Spitballing a bit here, but |
Speaking of that, there's an annoying special case that I don't think we're going to support: A file can have the same content in two commits but different .gitattributes, which ideally should make it show up in diffs. For example, let's say a file is committed with LF line endings, and in commit A it has a .gitattributes that says to convert those to CRLF and in commit B it doesn't have any .gitattributes. When diffing that file, you could argue that you should see the change in line endings. That would make diffing slow, however, since we can't say that a tree/file is unchanged if there are changes in .gitattributes in a parent directory. I asked the Git team at Google about this case a long time ago, and my recollection is that Git doesn't handle that case. It's of course easy to check but I haven't. |
I tested this out, and I'm pretty sure git doesn't handle it. Click to see transcript of testing it outCreate a test repo
Now add a file with LF line endings:
Now set
At this point, git see no differences, and the file in the working copy still has LF line endings:
Adding two more lines still leaves the file with LF line endings:
Even trying to
It's only when I take an action where git itself modifies the working copy file that it changes the line endings:
Finally,
|
Thanks for checking! |
Indeed the lack of |
Just to make sure you know, you should still be able to use jj in a non-colocated workspace, i.e. if you do |
We'll probably want to support at least the
eol
attribute. I noticed while using jj in a working copy shared with git that some files appeared modified because they had LF in the commit and CRLF in the working copy.The text was updated successfully, but these errors were encountered: