summaryrefslogtreecommitdiff
path: root/src/object.h
Commit message (Collapse)AuthorAgeFilesLines
* blob: use `git_object_size_t` for object sizeEdward Thomson2019-11-221-0/+2
| | | | | Instead of using a signed type (`off_t`) use a new `git_object_size_t` for the sizes of objects.
* object_type: GIT_OBJECT_BAD is now GIT_OBJECT_INVALIDEdward Thomson2019-01-171-1/+1
| | | | | | | We use the term "invalid" to refer to bad or malformed data, eg `GIT_REF_INVALID` and `GIT_EINVALIDSPEC`. Since we're changing the names of the `git_object_t`s in this release, update it to be `GIT_OBJECT_INVALID` instead of `BAD`.
* object_type: use new enumeration namesethomson/index_fixesEdward Thomson2018-12-011-10/+10
| | | | Use the new object_type enumeration names within the codebase.
* object: implement function to parse raw dataPatrick Steinhardt2018-06-221-0/+11
| | | | | | | | | Now that we have implement functions to parse all git objects from raw data, we can implement a generic function `git_object__from_raw` to create a structure of type `git_object`. This allows us to parse and interpret objects from raw data without having to touch the ODB at all, which is especially useful for object verification prior to accepting them into the repository.
* object: introduce git_object_stringn2typeEdward Thomson2017-12-201-0/+2
| | | | | | | | | Introduce an internal API to get the object type based on a length-specified (not null terminated) string representation. This can be used to compare the (space terminated) object type name in a loose object. Reimplement `git_object_string2type` based on this API.
* Make sure to always include "common.h" firstPatrick Steinhardt2017-07-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
* settings: rename `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`Patrick Steinhardt2017-06-081-1/+0
| | | | | | | | | | | Initially, the setting has been solely used to enable the use of `fsync()` when creating objects. Since then, the use has been extended to also cover references and index files. As the option is not yet part of any release, we can still correct this by renaming the option to something more sensible, indicating not only correlation to objects. This commit renames the option to `GIT_OPT_ENABLE_FSYNC_GITDIR`. We also move the variable from the object to repository source code.
* fsync: call it "synchronous" object writingEdward Thomson2017-02-281-1/+1
| | | | | Rename `GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION` -> `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`.
* Add `ENABLE_SYNCHRONIZED_OBJECT_CREATION` optionEdward Thomson2017-02-281-0/+1
| | | | Allow users to enable `SYNCHRONIZED_OBJECT_CREATION` with a setting.
* git_object__is_valid: use `odb_read_header`Edward Thomson2016-02-281-15/+4
| | | | | This allows lighter weight validation in `git_object__is_valid` that does not require reading the entire object.
* git_index_add: validate objects in index entries (optionally)Edward Thomson2016-02-281-0/+16
| | | | | When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate the index entries given to `git_index_add`.
* git_object__is_valid: simple object validity testEdward Thomson2016-02-281-0/+16
|
* git_libgit2_opts: introduce `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION`Edward Thomson2016-02-281-0/+2
|
* object: Explicitly define helper API methods for all obj typesVicent Marti2013-04-301-12/+0
|
* Some cleanupsRussell Belfer2013-04-291-1/+1
| | | | | Removed useless prototype and renamed object typecast functions declaration macro.
* Standardize cast versions of git_object accessorsRussell Belfer2013-04-291-0/+12
| | | | | | 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.
* Duplicated type objectVicent Marti2013-04-221-1/+0
|
* object: Export git_object_dupVicent Marti2013-04-101-7/+0
|
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Reorg internal odb read header and object lookupRussell Belfer2012-09-101-0/+39
Often `git_odb_read_header` will "fail" and have to read the entire object into memory instead of just the header. When this happens, the object is loaded and then disposed of immediately, which makes it difficult to efficiently use the header information to decide if the object should be loaded (since attempting to do so will often result in loading the object twice). This commit takes the existing code and reorganizes it to have two new functions: - `git_odb__read_header_or_object` which acts just like the old read header function except that it returns the object, too, if it was forced to load the whole thing. It then becomes the callers responsibility to free the `git_odb_object`. - `git_object__from_odb_object` which was extracted from the old `git_object_lookup` and creates a subclass of `git_object` from an existing `git_odb_object` (separating the ODB lookup from the `git_object` creation). This allows you to use the first header reading function efficiently without instantiating the `git_odb_object` twice. There is no net change to the behavior of any of the existing functions, but this allows internal code to tap into the ODB lookup and object creation to be more efficient.