summaryrefslogtreecommitdiff
path: root/src/odb.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* odb: check if object exists before writingDavid Michael Barr2012-12-211-0/+4
| | | | | Update the procondition of git_odb_backend::write. It may now be assumed that the object has already been hashed.
* Merge pull request #1091 from carlosmn/stream-objectVicent Martí2012-12-071-3/+3
|\ | | | | Indexer speedup with large objects
| * indexer: use the packfile streaming APICarlos Martín Nieto2012-11-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The new API allows us to read the object bit by bit from the packfile, instead of needing it all at once in the packfile. This also allows us to hash the object as it comes in from the network instead of having to try to read it all and failing repeatedly for larger objects. This is only the first step, but it already shows huge improvements when dealing with objects over a few megabytes in size. It reduces the memory needs in some cases, but delta objects still need to be completely in memory and the old inefficent method is still used for that.
* | Deploy GITERR_CHECK_VERSIONBen Straub2012-11-301-14/+1
| |
* | Deploy versioned git_odb_backend structureBen Straub2012-11-301-0/+15
|/
* odb: Add `git_odb_add_disk_alternate`Vicent Marti2012-11-281-2/+6
| | | | | Loads a disk alternate by path to the ODB. Mimics the `GIT_ALTERNATE_OBJECT_DIRECTORIES` shell var.
* API updates for odb.hBen Straub2012-11-271-2/+2
|
* odb: recursively load alternatesCarlos Martín Nieto2012-11-161-8/+20
| | | | The maximum depth is 5, like in git
* Remove git_hash_ctx_new - callers now _ctx_init()Edward Thomson2012-11-131-7/+7
|
* Win32 CryptoAPI and CNG support for SHA1Edward Thomson2012-11-131-9/+16
|
* create callback to handle packs from fetch, move the indexer to odb_packEdward Thomson2012-11-051-0/+25
|
* git_odb_object_free: don't segfault w/ arg == NULLMichael Schubert2012-10-091-0/+3
|
* Fix error hashing empty file.Jameson Miller2012-09-271-1/+1
|
* odb: don't overflow the link path bufferCarlos Martín Nieto2012-09-161-2/+3
| | | | | Allocate a buffer large enough to store the path plus the terminator instead of letting readlink write beyond the end.
* Merge pull request #927 from arrbee/hashfile-with-filtersVicent Martí2012-09-131-0/+5
|\ | | | | Add git_repository_hashfile to hash with filters
| * Add tests and improve param checksRussell Belfer2012-09-111-0/+5
| | | | | | | | | | | | | | | | Fixed some minor `git_repository_hashfile` issues: - Fixed incorrect doc (saying that repo could be NULL) - Added checking of object type value to acceptable ones - Added more tests for various parameter permutations
* | Fix -Wuninitialized warningMichael Schubert2012-09-131-1/+1
|/
* Properly handle p_readsVicent Marti2012-09-111-9/+11
|
* Reorg internal odb read header and object lookupRussell Belfer2012-09-101-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Implement filters for status/diff blobsRussell Belfer2012-09-061-2/+31
| | | | | | | | | | | | | This adds support to diff and status for running filters (a la crlf) on blobs in the workdir before computing SHAs and before generating text diffs. This ended up being a bit more code change than I had thought since I had to reorganize some of the diff logic to minimize peak memory use when filtering blobs in a diff. This also adds a cap on the maximum size of data that will be loaded to diff. I set it at 512Mb which should match core git. Right now it is a #define in src/diff.h but it could be moved into the public API if desired.
* odb: mark unused variableMichael Schubert2012-09-061-0/+1
|
* Expose a malloc function to 3rd party ODB backendsPhilip Kelley2012-08-271-0/+5
|
* oid: Explicitly include `oid.h` for the inlined CMPVicent Marti2012-08-091-0/+1
|
* Merge remote-tracking branch 'arrbee/tree-walk-fixes' into developmentVicent Marti2012-08-061-1/+4
|\ | | | | | | | | | | | | | | | | Conflicts: src/notes.c src/transports/git.c src/transports/http.c src/transports/local.c tests-clar/odb/foreach.c
| * Update iterators for consistency across libraryRussell Belfer2012-08-031-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates all the `foreach()` type functions across the library that take callbacks from the user to have a consistent behavior. The rules are: * A callback terminates the loop by returning any non-zero value * Once the callback returns non-zero, it will not be called again (i.e. the loop stops all iteration regardless of state) * If the callback returns non-zero, the parent fn returns GIT_EUSER * Although the parent returns GIT_EUSER, no error will be set in the library and `giterr_last()` will return NULL if called. This commit makes those changes across the library and adds tests for most of the iteration APIs to make sure that they follow the above rules.
* | portability: Improve x86/amd64 compatibilitynulltoken2012-07-241-1/+1
|/
* odb: add git_odb_foreach()Carlos Martín Nieto2012-07-031-0/+12
| | | | | Go through each backend and list every objects that exists in them. This allows fsck-like uses.