summaryrefslogtreecommitdiff
path: root/src/odb.c
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* odb: don't leak when detecting id ambiguityCarlos Martín Nieto2012-06-201-0/+3
| | | | | | | If we find several objects with the same prefix, we need to free the memory where we stored the earlier object. Keep track of the raw.data pointer across read_prefix calls and free it if we find another object.
* errors: Rename error codesbreaking-changesVicent Martí2012-05-181-7/+7
|
* errors: Rename the generic return codesVicent Martí2012-05-181-12/+12
|
* Handle duplicate objects from different backends in git_odb_read_prefix().Han-Wen Nienhuys2012-05-121-10/+15
|
* Fix valgrind issuesRussell Belfer2012-05-041-3/+9
| | | | | | | There are three changes here: - correctly propogate error code from failed object lookups - make zlib inflate use our allocators - add OID to notfound error in ODB lookups
* Implement git_pool paged memory allocatorRussell Belfer2012-04-251-1/+1
| | | | | | | | | | | | | | | | | | This adds a `git_pool` object that can do simple paged memory allocation with free for the entire pool at once. Using this, you can replace many small allocations with large blocks that can then cheaply be doled out in small pieces. This is best used when you plan to free the small blocks all at once - for example, if they represent the parsed state from a file or data stream that are either all kept or all discarded. There are two real patterns of usage for `git_pools`: either for "string" allocation, where the item size is a single byte and you end up just packing the allocations in together, or for "fixed size" allocation where you are allocating a large object (e.g. a `git_oid`) and you generally just allocation single objects that can be tightly packed. Of course, you can use it for other things, but those two cases are the easiest.
* Convert indexer, notes, sha1_lookup, and signatureRussell Belfer2012-03-191-0/+4
| | | | More files moved to new error handling style.
* Continue error conversionRussell Belfer2012-03-141-3/+1
| | | | | | | This converts blob.c, fileops.c, and all of the win32 files. Also, various minor cleanups throughout the code. Plus, in testing the win32 build, I cleaned up a bunch (although not all) of the warnings with the 64-bit build.
* Migrate ODB files to new error handlingRussell Belfer2012-03-121-56/+57
| | | | | | | | | | | | | | This migrates odb.c, odb_loose.c, odb_pack.c and pack.c to the new style of error handling. Also got the unix and win32 versions of map.c. There are some minor changes to other files but no others were completely converted. This also contains an update to filebuf so that a zeroed out filebuf will not think that the fd (== 0) is actually open (and inadvertently call close() on fd 0 if cleaned up). Lastly, this was built and tested on win32 and contains a bunch of fixes for the win32 build which was pretty broken.
* Fix issues raised on pull requestRussell Belfer2012-03-071-6/+2
| | | | This resolves the comments on pull request #590
* Migrating diff to new error handlingRussell Belfer2012-03-061-113/+84
| | | | | | Ended up migrating a bunch of upstream functions as well including vector, attr_file, and odb in order to get this to work right.
* error-handling: ReferencesVicent Martí2012-03-061-1/+1
| | | | | Yes, this is error handling solely for `refs.c`, but some of the abstractions leak all ofer the code base.
* buffer: Unify `git_fbuffer` and `git_buf`Vicent Martí2012-02-271-3/+4
| | | | | | | | | | | | | | This makes so much sense that I can't believe it hasn't been done before. Kill the old `git_fbuffer` and read files straight into `git_buf` objects. Also: In order to fully support 4GB files in 32-bit systems, the `git_buf` implementation has been changed from using `ssize_t` for storage and storing negative values on allocation failure, to using `size_t` and changing the buffer pointer to a magical pointer on allocation failure. Hopefully this won't break anything.
* Fix warnings about type conversion on win32Russell Belfer2012-02-231-2/+2
|
* zlib: Remove custom `git2/zlib.h` headerVicent Martí2012-02-151-1/+1
| | | | | | This is legacy compat stuff for when `deflateBound` is not defined, but we're not embedding zlib and that function is always available. Kill that with fire.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* odb: Proper symlink hashingVicent Martí2012-02-101-0/+42
|
* odb: Add internal `git_odb__hashfd`Vicent Martí2012-02-101-22/+28
|
* Move path related functions from fileops to pathRussell Belfer2012-01-171-1/+1
| | | | | | | | | | | This takes all of the functions that look up simple data about paths (such as `git_futils_isdir`) and moves them over to path.h (becoming `git_path_isdir`). This leaves fileops.h just with functions that actually manipulate the filesystem or look at the file contents in some way. As part of this, the dir.h header which is really just for win32 support was moved into win32 (with some minor changes).
* Use git_buf for path storage instead of stack-based buffersRussell Belfer2011-12-071-10/+17
| | | | | | | | | | | | | | | | | | | | This converts virtually all of the places that allocate GIT_PATH_MAX buffers on the stack for manipulating paths to use git_buf objects instead. The patch is pretty careful not to touch the public API for libgit2, so there are a few places that still use GIT_PATH_MAX. This extends and changes some details of the git_buf implementation to add a couple of extra functions and to make error handling easier. This includes serious alterations to all the path.c functions, and several of the fileops.c ones, too. Also, there are a number of new functions that parallel existing ones except that use a git_buf instead of a stack-based buffer (such as git_config_find_global_r that exists alongsize git_config_find_global). This also modifies the win32 version of p_realpath to allocate whatever buffer size is needed to accommodate the realpath instead of hardcoding a GIT_PATH_MAX limit, but that change needs to be tested still.
* Rename all `_close` methodsVicent Marti2011-11-261-4/+4
| | | | | There's no difference between `_free` and `_close` semantics: keep everything with the same name to avoid confusions.
* repository: Change ownership semanticsVicent Marti2011-11-261-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ownership semantics have been changed all over the library to be consistent. There are no more "borrowed" or duplicated references. Main changes: - `git_repository_open2` and `3` have been dropped. - Added setters and getters to hotswap all the repository owned objects: `git_repository_index` `git_repository_set_index` `git_repository_odb` `git_repository_set_odb` `git_repository_config` `git_repository_set_config` `git_repository_workdir` `git_repository_set_workdir` Now working directories/index files/ODBs and so on can be hot-swapped after creating a repository and between operations. - All these objects now have proper ownership semantics with refcounting: they all require freeing after they are no longer needed (the repository always keeps its internal reference). - Repository open and initialization has been updated to keep in mind the configuration files. Bare repositories are now always detected, and a default config file is created on init. - All the tests affected by these changes have been dropped from the old test suite and ported to the new one.