summaryrefslogtreecommitdiff
path: root/src/crlf.c
Commit message (Collapse)AuthorAgeFilesLines
* Move crlf conversion into buf_textautocrlf-fixesRussell Belfer2013-03-251-63/+17
| | | | | | | | | | | | | | This adds crlf/lf conversion functions into buf_text with more efficient implementations that bypass the high level buffer functions. They attempt to minimize the number of reallocations done and they directly write the buffer data as needed if they know that there is enough memory allocated to memcpy data. Tests are added for these new functions. The crlf.c code is updated to use the new functions. Removed the include of buf_text.h from filter.h and just include it more narrowly in the places that need it.
* don't convert CRLF to CRCRLFEdward Thomson2013-03-251-4/+9
|
* Add has_cr_in_index check to CRLF filterRussell Belfer2013-03-251-8/+51
| | | | | | | | | | | | This adds a check to the drop_crlf filter path to check it the file in the index already has a CR in it, in which case this will not drop the CRs from the workdir file contents. This uncovered a "bug" in `git_blob_create_fromworkdir` where the full path to the file was passed to look up the attributes instead of the relative path from the working directory root. This meant that the check in the index for a pre-existing entry of the same name was failing.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Consolidate text buffer functionsRussell Belfer2012-11-281-8/+5
| | | | | | | | | | | | | There are many scattered functions that look into the contents of buffers to do various text manipulations (such as escaping or unescaping data, calculating text stats, guessing if content is binary, etc). This groups all those functions together into a new file and converts the code to use that. This has two enhancements to existing functionality. The old text stats function is significantly rewritten and the BOM detection code was extended (although largely we can't deal with anything other than a UTF8 BOM).
* Add git_repository_hashfile to hash with filtersRussell Belfer2012-09-111-2/+3
| | | | | | | | The existing `git_odb_hashfile` does not apply text filtering rules because it doesn't have a repository context to evaluate the correct rules to apply. This adds a new hashfile function that will apply repository-specific filters (based on config, attributes, and filename) before calculating the hash.
* Alternate test for autocrlf with statusRussell Belfer2012-09-061-1/+1
| | | | | I couldn't get the last failing test to actually fail. This is a different test suggested by @nulltoken which should fail.
* Checkout: crlf filter.Ben Straub2012-07-311-8/+80
|
* Checkout: obey core.symlinks.Ben Straub2012-07-171-1/+1
|
* Checkout: add structure for CRLF.Ben Straub2012-07-091-2/+18
|
* errors: Rename error codesbreaking-changesVicent Martí2012-05-181-1/+1
|
* errors: Rename the generic return codesVicent Martí2012-05-181-3/+3
|
* global: Change parameter ordering in APIVicent Martí2012-05-181-3/+3
| | | | Consistency is good.
* Support reading attributes from indexRussell Belfer2012-05-031-1/+2
| | | | | | | | | | | | | | Depending on the operation, we need to consider gitattributes in both the work dir and the index. This adds a parameter to all of the gitattributes related functions that allows user control of attribute reading behavior (i.e. prefer workdir, prefer index, only use index). This fix also covers allowing us to check attributes (and hence do diff and status) on bare repositories. This was a somewhat larger change that I hoped because it had to change the cache key used for gitattributes files.
* Remove old and unused error codesVicent Martí2012-05-021-2/+1
|
* buf: deploy git_buf_len()nulltoken2012-04-301-2/+2
|
* error-handling: RepositoryVicent Martí2012-03-071-2/+1
| | | | | | | | This also includes droping `git_buf_lasterror` because it makes no sense in the new system. Note that in most of the places were it has been dropped, the code needs cleanup. I.e. GIT_ENOMEM is going away, so instead it should return a generic `-1` and obviously not throw anything.
* Add filter tests and fix some bugsRussell Belfer2012-03-021-40/+20
| | | | | This adds some initial unit tests for file filtering and fixes some simple bugs in filter application.
* config: Implement a proper cvar cacheVicent Martí2012-03-021-2/+10
|
* attr: Change the attribute check macrosVicent Martí2012-03-021-4/+4
| | | | | | | | | | | | | | | | | | | | | The point of having `GIT_ATTR_TRUE` and `GIT_ATTR_FALSE` macros is to be able to change the way that true and false values are stored inside of the returned gitattributes value pointer. However, if these macros are implemented as a simple rename for the `git_attr__true` pointer, they will always be used with the `==` operator, and hence we cannot really change the implementation to any other way that doesn't imply using special pointer values and comparing them! We need to do the same thing that core Git does, which is using a function macro. With `GIT_ATTR_TRUE(attr)`, we can change internally the way that these values are stored to anything we want. This commit does that, and rewrites a large chunk of the attributes test suite to remove duplicated code for expected attributes, and to properly test the function macro behavior instead of comparing pointers.
* filter: Beautiful refactoringVicent Martí2012-03-011-34/+82
| | | | Comments soothe my soul.
* filter: Add write-to CRLF filterVicent Martí2012-02-291-0/+193