summaryrefslogtreecommitdiff
path: root/src/odb.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2178 from libgit2/rb/fix-short-idEdward Thomson2014-03-311-7/+17
|\ | | | | Fix git_odb_short_id and git_odb_exists_prefix bugs
| * Fix a number of git_odb_exists_prefix bugsRussell Belfer2014-03-101-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The git_odb_exists_prefix API was not dealing correctly when a later backend returned GIT_ENOTFOUND even if an earlier backend had found the object. Additionally, the unit tests were not properly exercising the API and had a couple mistakes in checking the results. Lastly, since the backends are not expected to behavior correctly unless all bytes of the short id are zero except for the prefix, this makes the ODB prefix APIs explicitly clear out the extra bytes so the user doesn't have to be as careful.
* | Fix wrong assertionLinquize2014-03-211-1/+1
|/ | | | Fixes issue #2196
* Added function-based initializers for every options struct.Matthew Bowen2014-03-051-0/+11
| | | | The basic structure of each function is courtesy of arrbee.
* Merge pull request #2159 from libgit2/rb/odb-exists-prefixVicent Marti2014-03-061-1/+55
|\ | | | | Add ODB API to check for existence by prefix and object id shortener
| * Check short OID len in odb, not in backendsRussell Belfer2014-03-051-1/+0
| |
| * Add exists_prefix to ODB backend and ODB APIRussell Belfer2014-03-041-0/+55
| |
* | ODB writing fails gracefully when unsupportedEdward Thomson2014-03-051-6/+12
|/ | | | If no ODB backends support writing, we should fail gracefully.
* odb: handle NULL pointers passed to git_odb_stream_freeBrodie Rao2014-01-121-0/+3
| | | | Signed-off-by: Brodie Rao <brodie@sf.io>
* Allow backend consumers to specify file modeEdward Thomson2013-11-041-1/+1
|
* Merge pull request #1891 from libgit2/cmn/fix-thin-packsVicent Martí2013-10-281-1/+1
|\ | | | | Add support for thin packs
| * indexer: fix thin packsCarlos Martín Nieto2013-10-041-1/+1
| | | | | | | | | | | | When given an ODB from which to read objects, the indexer will attempt to inject the missing bases at the end of the pack and update the header and trailer to reflect the new contents.
* | Implement `git_odb_object_dup`Vicent Marti2013-10-221-0/+7
|/
* Merge pull request #1840 from linquize/warningVicent Martí2013-09-211-2/+1
|\ | | | | Fix warning
| * Fix warningLinquize2013-09-191-2/+1
| |
* | Merge git_buf and git_bufferRussell Belfer2013-09-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Extend public filter api with filter listsRussell Belfer2013-09-171-7/+9
| | | | | | | | | | | | | | | | | | | | | | This moves the git_filter_list into the public API so that users can create, apply, and dispose of filter lists. This allows more granular application of filters to user data outside of libgit2 internals. This also converts all the internal usage of filters to the public APIs along with a few small tweaks to make it easier to use the public git_buffer stuff alongside the internal git_buf.
* | Create public filter object and use itRussell Belfer2013-09-171-3/+3
| | | | | | | | | | | | | | This creates include/sys/filter.h with a basic definition of a git_filter and then converts the internal code to use it. There are related internal objects (git_filter_list) that we will want to publish at some point, but this is a first step.
* | errors: Fix format of some error messagesnulltoken2013-09-111-1/+1
| |
* | odb: Error when streaming in too [few|many] bytesnulltoken2013-09-071-0/+27
|/
* odb: Prevent stream_finalize_write() from overwritingnulltoken2013-09-061-0/+4
| | | | | | Now that #1785 is merged, git_odb_stream_finalize_write() calculates the object id before invoking the odb backend. This commit gives a chance to the backend to check if it already knows this object.
* odb: Move the auto refresh logic to the pack backendnulltoken2013-09-041-35/+4
| | | | | | | | | | | | Previously, `git_object_read()`, `git_object_read_prefix()` and `git_object_exists()` were implementing an auto refresh logic. When the expected object couldn't be found in any backend, a call to `git_odb_refresh()` was triggered and the lookup was once again performed against all backends. This commit removes this auto-refresh logic from the odb layer and pushes it down into the pack-backend (as it's the only one currently exposing a `refresh()` endpoint).
* odb: Honor the non refreshing capability of a backendnulltoken2013-08-301-3/+3
|
* odb: avoid hashing twice in and edge caseCarlos Martín Nieto2013-08-171-2/+2
| | | | | | | If none of the backends support direct writes and we must stream the whole file, we already know what the object's id should be; so use the stream's functions directly, bypassing the frontend's hashing and overwriting of our existing id.
* odb: make it clearer that the id is calculated in the frontendCarlos Martín Nieto2013-08-171-4/+4
| | | | | | | | | | The frontend is in charge of calculating the id of the objects. Thus the backends should treat it as a read-only value. The positioning in the function signature made it seem as though it was an output parameter. Make the id const and move it from the front to behind the subject (backend or stream).
* odb: perform the stream hashing in the frontendCarlos Martín Nieto2013-08-151-0/+21
| | | | | | Hash the data as it's coming into the stream and tell the backend what its name is when finalizing the write. This makes it consistent with the way a plain git_odb_write() performs the write.
* odb: wrap the stream reading and writing functionsCarlos Martín Nieto2013-08-151-3/+23
| | | | | | This is in preparation for moving the hashing to the frontend, which requires us to handle the incoming data before passing it to the backend's stream.
* odb: free object data when id is ambiguousCarlos Martín Nieto2013-08-121-1/+3
| | | | | By the time we recognise this as an ambiguous id, the object's data has been loaded into memory. Free it when returning EABMIGUOUS.
* Fix some more memory leaks in error pathRémi Duraffort2013-07-151-0/+1
|
* util: It's called `memzero`Vicent Marti2013-06-121-1/+1
|
* Add safe memset and use itRussell Belfer2013-06-071-1/+1
| | | | | | This adds a `git__memset` routine that will not be optimized away and updates the places where I memset() right before a free() call to use it.
* Zero memory for major objects before freeingRussell Belfer2013-05-311-0/+2
| | | | | | | By zeroing out the memory when we free larger objects (i.e. those that serve as collections of other data, such as repos, odb, refdb), I'm hoping that it will be easier for libgit2 bindings to find errors in their object management code.
* Merge pull request #1526 from arrbee/cleanup-error-return-without-msgVicent Martí2013-05-061-22/+43
|\ | | | | Make sure error messages are set for most error returns
| * Catch some odd odb backend corner case errorsRussell Belfer2013-05-011-22/+43
| | | | | | | | | | | | | | There are some cases, particularly where no loaded ODB backends support a particular operation, where we would return an error code without having set an error. This catches those cases and reports that no ODB backends support the operation in question.
* | odb: Do not error out if an alternate ODB is missingVicent Marti2013-05-031-0/+3
|/
* Merge pull request #1518 from arrbee/export-oid-comparisonVicent Martí2013-04-301-1/+1
|\ | | | | Remove most inlines from the public API
| * Make git_oid_cmp public and add git_oid__cmpRussell Belfer2013-04-291-1/+1
| |
* | don't use uninitialized struct stat in win32Edward Thomson2013-04-291-4/+12
|/
* Add callback to git_objects_tableRussell Belfer2013-04-221-11/+20
| | | | | | | | | | This adds create and free callback to the git_objects_table so that more of the creation and destruction of objects can be table driven instead of using switch statements. This also makes the semantics of certain object creation functions consistent so that we can make better use of function pointers. This also fixes a theoretical error case where an object allocation fails and we end up storing NULL into the cache.
* What has science done.Vicent Marti2013-04-221-9/+12
|
* lol this worked first try wtfVicent Marti2013-04-221-15/+21
|
* Merge branch 'development' into vmg/dupe-odb-backendsvmg/dupe-odb-backendsVicent Marti2013-04-221-0/+22
|\ | | | | | | | | Conflicts: src/odb.c
| * Move odb_backend implementors stuff into git2/sysRussell Belfer2013-04-211-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | This moves some of the odb_backend stuff that is related to the internals of an odb_backend implementation into include/git2/sys. Some of the stuff related to streaming I left in include/git2 because it seemed like it would be reasonably needed by a normal user who wanted to stream objects into and out of the ODB. Also, I added APIs for traversing the list of backends so that some of the tests would not need to access ODB internals.
* | odb: Disable inode checks for Win32Vicent Marti2013-04-221-0/+4
| |
* | odb: Do not allow duplicate on-disk backendsVicent Marti2013-04-191-9/+28
|/
* opts: allow configuration of odb cache sizeMichael Schubert2013-03-251-1/+3
| | | | | | | | Currently, the odb cache has a fixed size of 128 slots as defined by GIT_DEFAULT_CACHE_SIZE. Allow users to set the size of the cache via git_libgit2_opts(). Fixes #1035.
* Several warnings detected by static code analyzer fixedArkadiy Shapkin2013-03-181-10/+10
| | | | | | | Implicit type conversion argument of function to size_t type Suspicious sequence of types castings: size_t -> int -> size_t Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)' Unsigned type is never < 0
* odb: Refresh on `exists` query tooVicent Marti2013-01-101-1/+12
|
* dat errorcodeVicent Marti2013-01-101-1/+2
|
* Sane refresh logicVicent Marti2013-01-101-6/+49
| | | | | | | All the ODB backends have a specific refresh interface. When reading an object, first we attempt every single backend: if the read fails, then we refresh all the backends and retry the read one more time to see if the object has appeared.