summaryrefslogtreecommitdiff
path: root/src/reader.c
Commit message (Collapse)AuthorAgeFilesLines
* blob: use `git_object_size_t` for object sizeEdward Thomson2019-11-221-1/+1
| | | | | Instead of using a signed type (`off_t`) use a new `git_object_size_t` for the sizes of objects.
* fileops: rename to "futils.h" to match function signaturesPatrick Steinhardt2019-07-201-1/+1
| | | | | | | | | Our file utils functions all have a "futils" prefix, e.g. `git_futils_touch`. One would thus naturally guess that their definitions and implementation would live in files "futils.h" and "futils.c", respectively, but in fact they live in "fileops.h". Rename the files to match expectations.
* blob: validate that blob sizes fit in a size_tEdward Thomson2019-01-251-2/+8
| | | | | | Our blob size is a `git_off_t`, which is a signed 64 bit int. This may be erroneously negative or larger than `SIZE_MAX`. Ensure that the blob size fits into a `size_t` before casting.
* git_error: use new names in internal APIs and usageEdward Thomson2019-01-221-4/+4
| | | | | Move to the `git_error` name in the internal API for error-related functions.
* object_type: use new enumeration namesethomson/index_fixesEdward Thomson2018-12-011-1/+1
| | | | Use the new object_type enumeration names within the codebase.
* apply: handle exact renamesEdward Thomson2018-11-051-1/+14
| | | | | | | Deltas containing exact renames are special; they simple indicate that a file was renamed without providing additional metadata (like the filemode). Teach the reader to provide the file mode and use the preimage's filemode in the case that the delta does not provide one.)
* apply: validate unchanged mode when applying bothEdward Thomson2018-11-051-0/+13
| | | | | | | When applying to both the index and the working directory, ensure that the working directory's mode matches the index's mode. It's not sufficient to look only at the hashed object id to determine that the file is unchanged, git also takes the mode into account.
* reader: free is unused and unnecessaryEdward Thomson2018-11-051-19/+0
| | | | | None of the reader implementations actually allocate anything themselves, so they don't need a free function. Remove it.
* reader: apply working directory filtersEdward Thomson2018-11-051-2/+13
| | | | | | | | When reading a file from the working directory, ensure that we apply any necessary filters to the item. This ensures that we get the repository-normalized data as the preimage, and further ensures that we can accurately compare the working directory contents to the index contents for accurate safety validation in the `BOTH` case.
* reader: optionally validate index matches workdirEdward Thomson2018-11-051-9/+31
| | | | | When using a workdir reader, optionally validate that the index contents match the working directory contents.
* apply: use preimage as the checkout baselineEdward Thomson2018-11-051-3/+20
| | | | | | | | | | | | | | | | Use the preimage as the checkout's baseline. This allows us to support applying patches to files that are modified in the working directory (those that differ from the HEAD and index). Without this, files will be reported as (checkout) conflicts. With this, we expect the on-disk data when we began the patch application (the "preimage") to be on-disk during checkout. We could have also simply used the `FORCE` flag to checkout to accomplish a similar mechanism. However, `FORCE` ignores all differences, while providing a preimage ensures that we will only overwrite the file contents that we actually read. Modify the reader interface to provide the OID to support this.
* reader: a generic way to read files from reposEdward Thomson2018-11-041-0/+202
Similar to the `git_iterator` interface, the `git_reader` interface will allow us to read file contents from an arbitrary repository-backed data source (trees, index, or working directory).