Optionally read .gitattributes from HEAD#5189
Merged
Conversation
Add a LF->CRLF conversion test to the blob filter.
pks-t
requested changes
Aug 1, 2019
Member
pks-t
left a comment
There was a problem hiding this comment.
A pleasant read, thanks a lot! :) Some comments, but overall this looks really good to me
Provide a function to filter blobs that allows for more functionality than the existing `git_blob_filtered_content` function.
Move users of `git_blob_filtered_content` to `git_blob_filter`.
Users should now use `git_blob_filter`.
By default, `/etc/gitattributes` (or the system equivalent) is read to provide attributes. Ensure that, by default, this is read when filtering blobs.
Test that we can optionally ignore system attributes when filtering a blob.
Allow system-wide attributes (the ones specified in `/etc/gitattributes`) to be ignored if the flag `GIT_FILTER_NO_SYSTEM_ATTRIBUTES` is specified.
Introduce `GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES`, which tells `git_blob_filter` to ignore the system-wide attributes file, usually `/etc/gitattributes`. This simply passes the appropriate flag to the attribute loading code.
When `GIT_ATTR_CHECK_INCLUDE_HEAD` is specified, read `gitattribute` files that are checked into the repository at the HEAD revision.
When `GIT_FILTER_ATTRIBUTES_FROM_HEAD` is specified, configure the filter to read filter attributes from `gitattributes` files that are checked in to the repository at the HEAD revision. This passes the flag `GIT_ATTR_CHECK_INCLUDE_HEAD` to the attribute reading functions.
When `GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD` is passed to `git_blob_filter`, read attributes from `gitattributes` files that are checked in to the repository at the HEAD revision. This passes the flag `GIT_FILTER_ATTRIBUTES_FROM_HEAD` to the filter functions.
871a8ed to
21c196e
Compare
Add a subdirectory in the crlf.git bare repository that has a second-level .gitattribute file.
Ensure that a `.gitattributes` file that is deeper in the tree is honored, not just an attributes file at the root.
21c196e to
cdbbb36
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, we honor
.gitattributes, behaving like git - reading from the working directory and / or the index. We do not read any attributes out ofHEAD.However, some consumers may want to examine a bare repository, and read the file contents as if the filters were being applied. Provide an update to
git_blob_filterthat take a new option to indicate that filters should be read fromHEAD.Deprecate
git_blob_filtered_contentin favor ofgit_blob_filter.