summaryrefslogtreecommitdiff
path: root/src/refs.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Change the object creation/lookup APIVicent Marti2011-03-031-4/+4
| | | | | | | | | | | | | | | | | | The methods previously known as git_repository_lookup git_repository_newobject git_repository_lookup_ref are now part of their respective namespaces: git_object_lookup git_object_new git_reference_lookup This makes the API more consistent with the new references API. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Fix reference removal: remove packed refs together with loose onesnulltoken2011-03-031-2/+16
|
* Fix corner case in reference renamingnulltoken2011-03-031-0/+9
| | | | | Renaming a packed reference should not pack another reference which happens to be in both loose and pack state.
* Add new move function, `gitfo_mv_force`Vicent Marti2011-03-031-2/+2
| | | | | | | Forces a move by creating the folder for the destination file, if it doesn't exist. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Fix refs renaming to prevent renaming with an invalid namenulltoken2011-03-031-1/+6
|
* Fix reference renaming to prevent duplicated namesnulltoken2011-03-031-0/+10
|
* Fix reference renaming implementation to match standard git behaviornulltoken2011-03-031-14/+51
|
* Prevent _dirent_loose_load() from choking on empty foldersnulltoken2011-03-031-1/+1
|
* Finish the References APIVicent Marti2011-03-031-217/+766
| | | | | | | | | | | | | | The following methods have been implemented: git_reference_packall git_reference_rename git_reference_delete The library now has full support for packed references, including partial and total writing. Internal documentation has been updated with the details. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Split packed from unpacked referencesVicent Marti2011-03-031-113/+142
| | | | | | | | These two reference types are now stored separately to eventually allow the removal/renaming of loose references and rewriting of the refs packfile. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Brush up the refs APIVicent Marti2011-03-031-64/+30
| | | | | | | | Changed some more API details and updated documentation. Sketched API for addition/removal of entries. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Refactored the reference creation API.nulltoken2011-03-031-76/+152
|
* Added some more tests to ensure the correct behavior of ↵nulltoken2011-03-031-7/+2
| | | | git_reference__normalize_name().
* Added git_reference__normalize_name() along with tests.nulltoken2011-03-031-4/+100
|
* Rewrite git_hashtable internalsVicent Marti2011-02-221-22/+12
| | | | | | | | | | | | | | | | The old hash table with chained buckets has been replaced by a new one using Cuckoo hashing, which offers guaranteed constant lookup times. This should improve speeds on most use cases, since hash tables in libgit2 are usually used as caches where the objects are stored once and queried several times. The Cuckoo hash implementation is based off the one in the Basekit library [1] for the IO language, but rewritten to support an arbritrary number of hashes. We currently use 3 to maximize the usage of the nodes pool. [1]: https://github.com/stevedekorte/basekit/blob/master/source/CHash.c Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Rewrite all file IO for more performanceVicent Marti2011-02-211-12/+10
| | | | | | | | | | | | | | | | | | | | 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>
* Use the new git__joinpath to build paths in methodsVicent Marti2011-02-091-6/+3
| | | | | | | | | | | | | | | | | 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>
* Fix more issues with Win32 EOLVicent Marti2011-02-021-5/+12
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Fix EOL issues in ref parsing under Win32Vicent Marti2011-02-021-5/+28
| | | | | | Reference files can be loaded using Win32 line endings, too. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Refactor reference parsing codeVicent Marti2011-01-301-317/+411
| | | | | | | | | 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>
* Merge nulltoken's reference parsing codenulltoken2011-01-291-0/+547
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.