summaryrefslogtreecommitdiff
path: root/include/git2/blob.h
Commit message (Collapse)AuthorAgeFilesLines
* filter: introduce GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMITEdward Thomson2021-07-221-0/+12
| | | | | Provide a mechanism to filter using attribute data from a specific commit (making use of `GIT_ATTR_CHECK_INCLUDE_COMMIT`).
* Fix typopunkymaniac2021-04-221-1/+1
|
* Merge pull request #5760 from libgit2/ethomson/tttoo_many_tttsEdward Thomson2021-01-071-1/+1
|\ | | | | blob: fix name of `GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD`
| * blob: fix name of `GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD`ethomson/tttoo_many_tttsEdward Thomson2021-01-051-1/+1
| | | | | | | | | | | | `GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD` is misspelled, it should be `GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD`, and it would be if it were not for the MacBook Pro keyboard and my inattentiveness.
* | Update documentation for git_blob_filter_optionsJosh Stockin2021-01-051-1/+2
| | | | | | | | Adds info about initializing options with git_blob_filter_options_init
* | blob: add git_blob_filter_options_initEdward Thomson2021-01-051-0/+12
| | | | | | | | | | | | The `git_blob_filter_options_init` function should be included, to allow callers in FFI environments to let us initialize an options structure for them.
* | Fix documentation for git_blob_filter_optionsJosh Stockin2021-01-041-1/+1
| |
* | Move doc comment about `GIT_BLOB_FILTER_OPTIONS_VERSION`Josh Stockin2021-01-041-1/+3
| | | | | | | | | | | | | | | | | | | | Removes doc comment on `git_blob_filter_options.version`, moves information to `git_blob_filter_options` doc comment to remain consistent with other options structures' documentation. `git_blob_filter_options_init` still needed; should be added in another commit/PR (it's out of the scope of this PR, #5759), update this documentation again.
* | Add documentation for git_blob_filter_options.versionJosh Stockin2021-01-031-0/+1
|/ | | | Resolves #5756
* blob: use GIT_ASSERTEdward Thomson2020-11-251-1/+1
|
* 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.
* Don't use enum for flagsSven Strickroth2019-09-261-2/+2
| | | | | | Using an `enum` causes trouble when used with C++ as bitwise operations are not possible w/o casting (e.g., `opts.flags &= ~GIT_BLOB_FILTER_CHECK_FOR_BINARY;` is invalid as there is no `&=` operator for `enum`). Signed-off-by: Sven Strickroth <email@cs-ware.de>
* blob: optionally read attributes from repositoryEdward Thomson2019-08-111-0/+6
| | | | | | | 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.
* blob: allow blob filtering to ignore system gitattributesEdward Thomson2019-08-111-0/+6
| | | | | | | | 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.
* blob: deprecate `git_blob_filtered_content`Edward Thomson2019-08-111-19/+0
| | | | Users should now use `git_blob_filter`.
* blob: introduce git_blob_filterEdward Thomson2019-08-111-0/+39
| | | | | Provide a function to filter blobs that allows for more functionality than the existing `git_blob_filtered_content` function.
* blob: add underscore to `from` functionsEdward Thomson2019-06-161-7/+7
| | | | | | The majority of functions are named `from_something` (with an underscore) instead of `fromsomething`. Update the blob functions for consistency with the rest of the library.
* Fix last references to deprecated git_buf_freeSven Strickroth2018-06-181-1/+1
| | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* Remove traces of `git_blob_create_fromchunks`Arthur Schreiber2016-04-261-41/+0
|
* git_object_dup: introduce typesafe versionsEdward Thomson2016-03-231-0/+9
|
* blob: introduce creating a blob by writing into a streamCarlos Martín Nieto2016-03-221-0/+43
| | | | | | | | | | | | | | | | | | | | | 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.
* fix git_blob_create_fromchunks documentationtepas2015-12-161-2/+2
| | | putting `0.` at the start of the line turns it into a numbered list.
* blob: don't recomment using git_buf_growCarlos Martín Nieto2015-06-241-6/+4
| | | | | | | | | We currently recommend using `git_buf_grow` in order to make a buffer make an owned copy of the memory it points to. This is not behaviour we should encourage, so remove this recommendation. The function itself is not changed, as we need to remain compatible, but it will be changed not to allow usage on borrowed buffers.
* [Blob] Update documentation for is_binary.Ungureanu Marius2014-05-281-1/+1
| | | filter.h tells me that we check the first 8000 bytes.
* Const correctness!Jacques Germishuys2014-04-031-1/+1
|
* Some missing oid to id renamesRussell Belfer2014-01-301-2/+3
|
* Handle git_buf's from users more liberallyEdward Thomson2014-01-081-1/+1
|
* Update git_blob_create_fromchunks callback behavrRussell Belfer2013-12-111-24/+19
| | | | | | | 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.
* Merge git_buf and git_bufferRussell Belfer2013-09-171-5/+5
| | | | | | | | | | | This makes the git_buf struct that was used internally into an externally available structure and eliminates the git_buffer. As part of that, some of the special cases that arose with the externally used git_buffer were blended into the git_buf, such as being careful about git_buf objects that may have a NULL ptr and allowing for bufs with a valid ptr and size but zero asize as a way of referring to externally owned data.
* Start of filter API + git_blob_filtered_contentRussell Belfer2013-09-171-0/+32
| | | | | | | | | | This begins the process of exposing git_filter objects to the public API. This includes: * new public type and API for `git_buffer` through which an allocated buffer can be passed to the user * new API `git_blob_filtered_content` * make the git_filter type and GIT_FILTER_TO_... constants public
* Standardize cast versions of git_object accessorsRussell Belfer2013-04-291-17/+11
| | | | | | This removes the GIT_INLINE versions of the simple git_object accessors and standardizes them with a helper macro in src/object.h to build the function bodies.
* Remove GIT_SUCCESS from documentationMiquel Canes Gonzalez2013-03-241-1/+1
|
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Share git_diff_blobs/git_diff_blob_to_buffer codeRussell Belfer2013-01-071-2/+2
| | | | | | | This moves the implementation of these two APIs into common code that will be shared between the two. Also, this adds tests for the `git_diff_blob_to_buffer` API. Lastly, this adds some extra `const` to a few places that can use it.
* blob: introduce git_blob_is_binary()nulltoken2012-12-171-0/+13
|
* More external API cleanupVicent Marti2012-11-271-9/+23
| | | | | | Conflicts: src/branch.c tests-clar/refs/branches/create.c
* portability: Improve x86/amd64 compatibilitynulltoken2012-07-241-1/+1
|
* blob: add git_blob_create_fromchunks()nulltoken2012-06-071-0/+42
|
* errors: Rename the generic return codesVicent Martí2012-05-181-5/+5
|
* blob: Add git_blob_create_fromdisk()nulltoken2012-05-131-0/+12
| | | | This function will create blobs in the object database from files anywhere on the filesystem. This can be run against bare and non-bare repositories.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* Rename all `_close` methodsVicent Marti2011-11-261-3/+3
| | | | | There's no difference between `_free` and `_close` semantics: keep everything with the same name to avoid confusions.
* Cleanup legal dataVicent Marti2011-09-191-21/+3
| | | | | | | | | | 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
* Standardized doxygen @return lines for int functions to say "GIT_SUCCESS or ↵David Boyce2011-09-131-4/+4
| | | | an error code".
* Fix some random size_t vs. int conversion warningsSebastian Schuberth2011-09-081-1/+1
|
* Added methods to search objects of different typesMarc Pegon2011-06-061-0/+17
| | | | given an OID prefix.
* Do not return on `void` helper methodsVicent Marti2011-03-231-1/+1
| | | | MSVC doesn't swallow that.
* Add close wappers for commit, tree, tag and blobCarlos Martín Nieto2011-03-231-0/+18
| | | | | | | | In the same spirit that git_repository_lookup is no longer available, add wrappers so the users don't have to cast when closing their objects. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* I broke your bindingsVicent Marti2011-03-201-46/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hey. Apologies in advance -- I broke your bindings. This is a major commit that includes a long-overdue redesign of the whole object-database structure. This is expected to be the last major external API redesign of the library until the first non-alpha release. Please get your bindings up to date with these changes. They will be included in the next minor release. Sorry again! Major features include: - Real caching and refcounting on parsed objects - Real caching and refcounting on objects read from the ODB - Streaming writes & reads from the ODB - Single-method writes for all object types - The external API is now partially thread-safe The speed increases are significant in all aspects, specially when reading an object several times from the ODB (revwalking) and when writing big objects to the ODB. Here's a full changelog for the external API: blob.h ------ - Remove `git_blob_new` - Remove `git_blob_set_rawcontent` - Remove `git_blob_set_rawcontent_fromfile` - Rename `git_blob_writefile` -> `git_blob_create_fromfile` - Change `git_blob_create_fromfile`: The `path` argument is now relative to the repository's working dir - Add `git_blob_create_frombuffer` commit.h -------- - Remove `git_commit_new` - Remove `git_commit_add_parent` - Remove `git_commit_set_message` - Remove `git_commit_set_committer` - Remove `git_commit_set_author` - Remove `git_commit_set_tree` - Add `git_commit_create` - Add `git_commit_create_v` - Add `git_commit_create_o` - Add `git_commit_create_ov` tag.h ----- - Remove `git_tag_new` - Remove `git_tag_set_target` - Remove `git_tag_set_name` - Remove `git_tag_set_tagger` - Remove `git_tag_set_message` - Add `git_tag_create` - Add `git_tag_create_o` tree.h ------ - Change `git_tree_entry_2object`: New signature is `(git_object **object_out, git_repository *repo, git_tree_entry *entry)` - Remove `git_tree_new` - Remove `git_tree_add_entry` - Remove `git_tree_remove_entry_byindex` - Remove `git_tree_remove_entry_byname` - Remove `git_tree_clearentries` - Remove `git_tree_entry_set_id` - Remove `git_tree_entry_set_name` - Remove `git_tree_entry_set_attributes` object.h ------------ - Remove `git_object_new - Remove `git_object_write` - Change `git_object_close`: This method is now *mandatory*. Not closing an object causes a memory leak. odb.h ----- - Remove type `git_rawobj` - Remove `git_rawobj_close` - Rename `git_rawobj_hash` -> `git_odb_hash` - Change `git_odb_hash`: New signature is `(git_oid *id, const void *data, size_t len, git_otype type)` - Add type `git_odb_object` - Add `git_odb_object_close` - Change `git_odb_read`: New signature is `(git_odb_object **out, git_odb *db, const git_oid *id)` - Change `git_odb_read_header`: New signature is `(size_t *len_p, git_otype *type_p, git_odb *db, const git_oid *id)` - Remove `git_odb_write` - Add `git_odb_open_wstream` - Add `git_odb_open_rstream` odb_backend.h ------------- - Change type `git_odb_backend`: New internal signatures are as follows int (* read)(void **, size_t *, git_otype *, struct git_odb_backend *, const git_oid *) int (* read_header)(size_t *, git_otype *, struct git_odb_backend *, const git_oid *) int (* writestream)(struct git_odb_stream **, struct git_odb_backend *, size_t, git_otype) int (* readstream)( struct git_odb_stream **, struct git_odb_backend *, const git_oid *) - Add type `git_odb_stream` - Add enum `git_odb_streammode` Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Change the return type of `git_blob_rawcontent`Vicent Marti2011-03-051-1/+1
| | | | | | Should return `void *` for raw bytes. Signed-off-by: Vicent Marti <tanoku@gmail.com>