summaryrefslogtreecommitdiff
path: root/tests/object/blob
Commit message (Collapse)AuthorAgeFilesLines
* tests: blob: remove unused callback functionPatrick Steinhardt2016-08-091-16/+0
|
* blob: remove _fromchunks()cmn/createblob-streamCarlos Martín Nieto2016-03-221-156/+0
| | | | | | The callback mechanism makes it awkward to write data from an IO source; move to `_fromstream()` which lets the caller remain in control, in the same vein as we prefer iterators over foreach callbacks.
* blob: fix fromchunks iteration counterCarlos Martín Nieto2016-03-222-6/+6
| | | | | | | | By returning when the count goes to zero rather than below it, setting `howmany` to 7 in fact writes out the string 6 times. Correct the termination condition to write out the string the amount of times we specify.
* blob: introduce creating a blob by writing into a streamCarlos Martín Nieto2016-03-221-0/+103
| | | | | | | | | | | | | | | | | | | | | The pair of `git_blob_create_frombuffer()` and `git_blob_create_frombuffer_commit()` is meant to replace `git_blob_create_fromchunks()` by providing a way for a user to write a new blob when they want filtering or they do not know the size. This approach allows the caller to retain control over when to add data to this buffer and a more natural fit into higher-level language's own stream abstractions instead of having to handle IO wait in the callback. The in-memory buffer size of 2MB is chosen somewhat arbitrarily to be a round multiple of usual page sizes and a value where most blobs seem likely to be either going to be way below or way over that size. It's also a round number of pages. This implementation re-uses the helper we have from `_fromchunks()` so we end up writing everything to disk, but hopefully more efficiently than with a default filebuf. A later optimisation can be to avoid writing the in-memory contents to disk, with some extra complexity.
* Merge pull request #2334 from libgit2/rb/fix-2333Russell Belfer2014-05-121-3/+10
|\ | | | | Be more careful with user-supplied buffers
| * Be more careful with user-supplied buffersrb/fix-2333Russell Belfer2014-05-081-3/+10
| | | | | | | | | | | | | | | | | | | | | | This adds in missing calls to `git_buf_sanitize` and fixes a number of places where `git_buf` APIs could inadvertently write NUL terminator bytes into invalid buffers. This also changes the behavior of `git_buf_sanitize` to NUL terminate a buffer if it can and of `git_buf_shorten` to do nothing if it can. Adds tests of filtering code with zeroed (i.e. unsanitized) buffer which was previously triggering a segfault.
* | Add filter options and ALLOW_UNSAFERussell Belfer2014-05-061-1/+1
|/ | | | | | | | | Diff and status do not want core.safecrlf to actually raise an error regardless of the setting, so this extends the filter API with an additional options flags parameter and adds a flag so that filters can be applied with GIT_FILTER_OPT_ALLOW_UNSAFE, indicating that unsafe filter application should be downgraded from a failure to a warning.
* Update git_blob_create_fromchunks callback behavrRussell Belfer2013-12-111-1/+38
| | | | | | | The callback to supply data chunks could return a negative value to stop creation of the blob, but we were neither using GIT_EUSER nor propagating the return value. This makes things use the new behavior of returning the negative value back to the user.
* Rename tests-clar to testsBen Straub2013-11-143-0/+331