src/refs.c


Log

Author Commit Date CI Message
Vicent Marti 817c2820 2011-02-21T17:05:16 Rewrite all file IO for more performance The new `git_filebuf` structure provides atomic high-performance writes to disk by using a write cache, and optionally a double-buffered scheme through a worker thread (not enabled yet). Writes can be done 3-layered, like in git.git (user code -> write cache -> disk), or 2-layered, by writing directly on the cache. This makes index writing considerably faster. The `git_filebuf` structure contains all the old functionality of `git_filelock` for atomic file writes and reads. The `git_filelock` structure has been removed. Additionally, the `git_filebuf` API allows to automatically hash (SHA1) all the data as it is written to disk (hashing is done smartly on big chunks to improve performance). Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 995f9c34 2011-02-09T12:43:19 Use the new git__joinpath to build paths in methods The `git__joinpath` function has been changed to use a statically allocated buffer; we assume the buffer to be 4096 bytes, because fuck you. The new method also supports an arbritrary number of paths to join, which may come in handy in the future. Some methods which were manually joining paths with `strcpy` now use the new function, namely those in `index.c` and `refs.c`. Based on Emeric Fermas' original patch, which was using the old `git__joinpath` because I'm stupid. Thanks! Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti ddc9e79a 2011-02-02T06:16:50 Fix more issues with Win32 EOL Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti ff5873ad 2011-02-02T04:01:14 Fix EOL issues in ref parsing under Win32 Reference files can be loaded using Win32 line endings, too. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 2f8a8ab2 2011-01-29T01:56:25 Refactor reference parsing code Several changes have been committed to allow the user to create in-memory references and write back to disk. Peeling of symbolic references has been made explicit. Added getter and setter methods for all attributes on a reference. Added corresponding documentation. Signed-off-by: Vicent Marti <tanoku@gmail.com>
nulltoken 9282e921 2010-12-27T20:34:19 Merge nulltoken's reference parsing code All the commits have been squashed into a single one before refactoring the final code, to keep everything tidy. Individual commit messages are as follows: Added repository reference looking up functionality placeholder. Added basic reference database definition and caching infrastructure. Removed useless constant. Added GIT_EINVALIDREFNAME error and description. Added missing description for GIT_EBAREINDEX. Added GIT_EREFCORRUPTED error and description. Added GIT_ETOONESTEDSYMREF error and description. Added resolving of direct and symbolic references. Prepared the packed-refs parsing. Added parsing of the packed-refs file content. When no loose reference has been found, the full content of the packed-refs file is parsed. All of the new (i.e. not previously parsed as a loose reference) references are eagerly stored in the cached references storage. The method packed_reference_file__parse() is in deer need of some refactoring. :-) Extracted to a method the parsing of the peeled target of a tag. Extracted to a method the parsing of a standard packed ref. Fixed leaky removal of the cached references. Ensured that a previously parsed packed reference isn't returned if a more up-to-date loose reference exists. Enhanced documentation of git_repository_reference_lookup(). Moved some refs related constants from repository.c to refs.h. Made parsing of a packed tag reference more robust. Updated git_repository_reference_lookup() documentation. Added some references to the test repository. Added some tests covering tag references looking up. Added some tests covering symbolic and head references looking up. Added some tests covering packed references looking up.