summaryrefslogtreecommitdiff
path: root/src/odb_pack.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix valgrind issuesRussell Belfer2012-05-041-3/+3
| | | | | | | 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
* buf: deploy git_buf_len()nulltoken2012-04-301-1/+1
|
* Fix warnings on 64-bit windows buildsRussell Belfer2012-04-171-4/+4
| | | | | This fixes all the warnings on win64 except those in deps, which come from the regex code.
* Convert attr, ignore, mwindow, status to new errorsRussell Belfer2012-03-161-1/+1
| | | | | Also cleaned up some previously converted code that still had little things to polish.
* Migrate ODB files to new error handlingRussell Belfer2012-03-121-88/+70
| | | | | | | | | | | | | | 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.
* 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.
* Clean up GIT_UNUSED macros on all platformsRussell Belfer2012-03-021-2/+2
| | | | | | | | | | | | | | | | | | | It turns out that commit 31e9cfc4cbcaf1b38cdd3dbe3282a8f57e5366a5 did not fix the GIT_USUSED behavior on all platforms. This commit walks through and really cleans things up more thoroughly, getting rid of the unnecessary stuff. To remove the use of some GIT_UNUSED, I ended up adding a couple of new iterators for hashtables that allow you to iterator just over keys or just over values. In making this change, I found a bug in the clar tests (where we were doing *count++ but meant to do (*count)++ to increment the value). I fixed that but then found the test failing because it was not really using an empty repo. So, I took some of the code that I wrote for iterator testing and moved it to clar_helpers.c, then made use of that to make it easier to open fixtures on a per test basis even within a single test file.
* 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>
* Move path related functions from fileops to pathRussell Belfer2012-01-171-2/+2
| | | | | | | | | | | 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-23/+29
| | | | | | | | | | | | | | | | | | | | 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.
* global: Properly use `git__` memory wrappersVicent Marti2011-10-281-5/+5
| | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* ignore missing pack file as git doesSven Strickroth2011-10-031-1/+4
| | | | | | See http://code.google.com/p/tortoisegit/issues/detail?id=862 Signed-off-by: Sven Strickroth <email@cs-ware.de>
* Merge pull request #384 from kiryl/warningsVicent Martí2011-09-181-4/+4
|\ | | | | Add more -W flags to CFLAGS
| * CMakefile: add -Wmissing-prototypes and fix warningsKirill A. Shutemov2011-08-301-4/+4
| | | | | | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | Tabify everythingVicent Marti2011-09-191-65/+65
| | | | | | | | | | | | There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.
* | 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.
* Drop STRLEN() macrosKirill A. Shutemov2011-08-251-1/+1
| | | | | | | There is no need in STRLEN macros. Compilers can do this trivial optimization on its own. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* Fix compilation in WindowsVicent Marti2011-08-081-0/+1
|
* Modify the given offset in git_packfile_unpackCarlos Martín Nieto2011-08-021-2/+2
| | | | | | | | The callers immediately throw away the offset, so we don't need any logical changes in any of them. This will be useful for the indexer, as it does need to know where the compressed data ends. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Move pack functions to their own fileCarlos Martín Nieto2011-08-021-525/+25
|
* Make packfile_unpack_header more genericCarlos Martín Nieto2011-08-021-348/+19
| | | | | | On the way, store the fd and the size in the mwindow file. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Move the pack structs to an internal headerCarlos Martín Nieto2011-08-021-59/+1
|
* Factor out the mmap window codeCarlos Martín Nieto2011-08-021-227/+37
| | | | | | | This code is useful for more things than just the packfile handling code. Factor it out so it can be reused. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* odb_pack: fix cast warningsKirill A. Shutemov2011-07-251-6/+6
| | | | | | | | | | | | | | | | | | | | | /home/kas/git/public/libgit2/src/odb_pack.c: In function ‘packfile_sort__cb’: /home/kas/git/public/libgit2/src/odb_pack.c:702:24: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c:703:24: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c: In function ‘nth_packed_object_offset’: /home/kas/git/public/libgit2/src/odb_pack.c:944:10: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c:944:10: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c:944:10: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c:948:9: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c:948:9: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c:948:9: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c:952:22: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c:952:22: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c:952:22: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c:953:8: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c:953:8: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/odb_pack.c:953:8: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* vector: Timsort all of the thingsVicent Marti2011-07-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Drop the GLibc implementation of Merge Sort and replace it with Timsort. The algorithm has been tuned to work on arrays of pointers (void **), so there's no longer a need to abstract the byte-width of each element in the array. All the comparison callbacks now take pointers-to-elements, not pointers-to-pointers, so there's now one less level of dereferencing. E.g. int index_cmp(const void *a, const void *b) { - const git_index_entry *entry_a = *(const git_index_entry **)(a); + const git_index_entry *entry_a = (const git_index_entry *)(a); The result is up to a 40% speed-up when sorting vectors. Memory usage remains lineal. A new `bsearch` implementation has been added, whose callback also supplies pointer-to-elements, to uniform the Vector API again.
* Small fixes in pack_window_openCarlos Martín Nieto2011-07-051-1/+6
| | | | | | | Check if the window structure has actually been allocated before trying to access it, and don't leak said structure if the map fails. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* fileops: CleanupVicent Marti2011-07-051-29/+29
| | | | | | | | | | | | | | | | Cleaned up the structure of the whole OS-abstraction layer. fileops.c now contains a set of utility methods for file management used by the library. These are abstractions on top of the original POSIX calls. There's a new file called `posix.c` that contains emulations/reimplementations of all the POSIX calls the library uses. These are prefixed with `p_`. There's a specific posix file for each platform (win32 and unix). All the path-related methods have been moved from `utils.c` to `path.c` and have their own prefix.
* cleanup: remove trailing spacesKirill A. Shutemov2011-07-011-6/+6
| | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* Allocate enough memory for the terminator in commit parsingCarlos Martín Nieto2011-06-201-1/+2
| | | | | | | | | Also allow space for the null-terminator when allocating the buffer in packfile_unpack_compressed. Up to now, the last newline had served as a terminator, but 858ef372 searches for a double-newline and exposes the problem. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* oid: Uniformize ncmp methodsVicent Marti2011-06-161-3/+3
| | | | Drop redundant methods. The ncmp method is now public
* oid: Rename methodsVicent Marti2011-06-161-2/+2
| | | | | Yeah. Finally. Fuck the old names, this ain't POSIX and they don't make any sense at all.
* Merge pull request #238 from pegonma/git_oid_ncmpVicent Martí2011-06-061-2/+2
|\ | | | | Better name for git_oid_match
| * Renamed git_oid_match to git_oid_ncmp.Marc Pegon2011-06-061-2/+2
| | | | | | | | | | | | As suggested by carlosmn, git_oid_ncmp would probably be a better name than git_oid_match, for it does the same as git_oid_cmp but only up to a certain amount of hex digits.
* | Fix build errors on MSVCJohan 't Hart2011-06-061-1/+1
|/
* odb-pack: More variable declarationsVicent Marti2011-06-021-4/+5
|
* odb-pack: Do not declare variables mid-functionVicent Marti2011-06-021-2/+2
|
* short-oid: CleanupVicent Marti2011-06-011-11/+21
|
* Fixed some error messages related to searching objects from a short oid. ↵Marc Pegon2011-06-011-13/+24
| | | | Fixed forgot to check that prefix length is greater than minimum prefix length in read_unique_short_oid method from pack backend.
* Added a GIT_OID_MINPREFIXLEN constant to define the minimum length allowed ↵Marc Pegon2011-06-011-0/+4
| | | | for oid prefixes (set to 4, like in git). Consequently updated some object lookup methods and their documentation.
* Added git.git sha1 lookup method to replace simple binary search in pack ↵Marc Pegon2011-06-011-51/+153
| | | | | | | | | | | | | | | backend. Implemented find_unique_short_oid for pack backend, based on git sha1 lookup method; finding an object given its full oid is just a particular case of searching the unique object matching an oid prefix (short oid). Added git_odb_read_unique_short_oid, which iterates over all the backends to find and read the unique object matching the given oid prefix. Added a git_object_lookup_short_oid method to find the unique object in the repository matching a given oid prefix : it generalizes git_object_lookup which now does nothing but calls git_object_lookup_short_oid.
* Added a read_unique_short_oid method to backends, to make it possible to ↵Marc Pegon2011-06-011-0/+15
| | | | find objects from sha1 prefixes in the future. Default implementations throw GIT_ENOTIMPLEMENTED for strict prefixes (i.e. length < GIT_OID_HEXSZ).
* odb_pack: Reword errorsVicent Marti2011-05-231-9/+9
|
* odb_pack.c: Move to new error handling mechanismJakob Pfender2011-05-231-39/+39
|
* Merge pull request #147 from nordsturm/fix_pack_backend_leak.Vicent Martí2011-05-011-0/+1
|\ | | | | Fix memory leak in pack_backend__free
| * Fix memory leak in pack_backend__freeSergey Nikishin2011-04-271-0/+1
| |
* | pack-odb: Check `mtime` instead of folder sizeVicent Marti2011-05-011-4/+4
|/ | | | | Do not check the folder's size to detect new packfiles at runtime. This doesn't work on Win32.
* Fix conversion warning in MSVCVicent Marti2011-04-231-4/+4
|
* Refresh the list of packfiles on each ODB queryVicent Marti2011-04-151-33/+46
| | | | | Fixes the issue where object lookups were failing right after a pull on an open repository.
* Switch from time_t to git_time_tnulltoken2011-03-231-2/+2
| | | | git_time_t is defined as a signed 64 integer. This allows a true predictable multiplatform behavior.