summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* Added git_reference__normalize_name() along with tests.nulltoken2011-03-031-0/+61
|
* Rewrite git_hashtable internalsVicent Marti2011-02-221-20/+11
| | | | | | | | | | | | | | | | 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>
* Add unit test for writing a big index fileVicent Marti2011-02-224-55/+57
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Improve the performance when writing Index filesVicent Marti2011-02-172-2/+17
| | | | | | | | | | | | | | In response to issue #60 (git_index_write really slow), the write_index function has been rewritten to improve its performance -- it should now be in par with the performance of git.git. On top of that, if Posix Threads are available when compiling libgit2, a new threaded writing system will be used (3 separate threads take care of solving byte-endianness, hashing the contents of the index and writing to disk, respectively). For very long Index files, this method is up to 3x times faster than git.git. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Internal changes on the backend systemVicent Marti2011-02-093-1/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The priority value for different backends has been removed from the public `git_odb_backend` struct. We handle that internally. The priority value is specified on the `git_odb_add_alternate`. This is convenient because it allows us to poll a backend twice with different priorities without having to instantiate it twice. We also differentiate between main backends and alternates; alternates have lower priority and cannot be written to. These changes come with some unit tests to make sure that the backend sorting is consistent. The libgit2 version has been bumped to 0.4.0. This commit changes the external API: CHANGED: struct git_odb_backend No longer has a `priority` attribute; priority for the backend in managed internally by the library. git_odb_add_backend(git_odb *odb, git_odb_backend *backend, int priority) Now takes an additional priority parameter, the priority that will be given to the backend. ADDED: git_odb_add_alternate(git_odb *odb, git_odb_backend *backend, int priority) Add a backend as an alternate. Alternate backends have always lower priority than main backends, and writing is disabled on them. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Use the new git__joinpath to build paths in methodsVicent Marti2011-02-092-43/+29
| | | | | | | | | | | | | | | | | 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>
* Added tests exercising git_reference_write() to create a new symbolic ↵nulltoken2011-02-071-1/+98
| | | | reference and a new object id reference.
* Merge branch 'refs-handling-tests' of https://github.com/nulltoken/libgit2Vicent Marti2011-02-072-4/+47
|\
| * Enforced refs handling tests.nulltoken2011-02-052-4/+47
| | | | | | | | | | - Added a test to ensure that a nested symbolic reference is properly resolved. - Added comparisons of object ids.
* | Fix a memory leak in git__joinpath() tests.nulltoken2011-02-061-0/+2
| |
* | Fixed a small issue in git__join_path(). Added tests to exercise ↵nulltoken2011-02-051-0/+29
| | | | | | | | git__join_path().
* | Made test index_write_test() remove the test file it has created.nulltoken2011-02-051-0/+2
| | | | | | | | It can now be run twice in a row without failing.
* | Add support for SQLite backendsVicent Marti2011-02-053-3/+129
| | | | | | | | | | | | | | | | | | | | | | | | Configure again the build system to look for SQLite3. If the library is found, the SQLite backend will be automatically compiled. Enjoy *very* fast reads and writes. MASTER PROTIP: Initialize the backend with ":memory" as the path to the SQLite database for fully-hosted in-memory repositories. Rejoice. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* | Move data from t03 to a separate headerVicent Marti2011-02-051-346/+1
|/ | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Fix directory/path manipulation methodsVicent Marti2011-02-051-41/+57
| | | | | | | | | | | | | | | | | | | | | | | | | The `dirname` and `dirbase` methods have been replaced with the Android implementation, which is actually compilant to some kind of standard. A new method `topdir` has been added, which returns the topmost directory in a path. These changes fix issue #49: `gitfo_prettify_dir_path` converts "./.git/" to ".git/", so the code at src/repository.c:190 goes out of bounds when trying to find the topmost directory. The new `git__topdir` method handles this gracefully, and the fixed `git__dirname` now returns the proper value for the repository's working dir. E.g. /repo/.git/ ==> working dir '/repo/' .git/ ==> working dir '.' Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Make more methods return error codesVicent Marti2011-02-051-1/+1
| | | | | | | | git_revwalk_next now returns an error code when the iteration is over. git_repository_index now returns an error code when the index file could not be opened. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Make the test return an error code on failureVicent Marti2011-02-023-6/+10
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Rewrite the unit testing suiteVicent Marti2011-02-0243-3492/+2978
| | | | | | | | | | | NIH Enterprises presents: a new testing system based on CuTesT, which is faster than our previous one and fortunately uses no preprocessing on the source files, which means we can run that from CMake. The test suites have been gathered together into bigger files (one file per suite, testing each of the different submodules of the library). Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Refactor reference parsing codeVicent Marti2011-01-303-69/+26
| | | | | | | | | 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-2912-0/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fixed naming convention related issue.nulltoken2011-01-291-2/+2
|
* Added git_prettify_file_path().nulltoken2011-01-291-72/+164
|
* Fixed a parsing issue in git_prettify_dir_path().nulltoken2011-01-291-1/+9
|
* Return the created entry in git_tree_add_entry()Vicent Marti2011-01-291-3/+8
| | | | | | | | | | Yes, we are breaking the API. Alpha software, deal with it. We need a way of getting a pointer to each newly added entry to the index, because manually looking up the entry after creation is outrageously expensive. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Small enhancements to git_prettify_dir_path().nulltoken2011-01-201-0/+12
| | | | | - Secured buffer ahead reading. - Guard against potential multiple dot path traversal (cf http://cwe.mitre.org/data/definitions/33.html)
* Fix signed/unsigned comparison warningVicent Marti2011-01-191-1/+1
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Added git_prettify_dir_path().nulltoken2011-01-111-0/+73
| | | | | | | | | | Clean up a provided absolute or relative directory path. This prettification relies on basic operations such as coalescing multiple forward slashes into a single slash, removing '.' and './' current directory segments, and removing parent directory whenever '..' is encountered. If not empty, the returned path ends with a forward slash. For instance, this will turn "d1/s1///s2/..//../s3" into "d1/s3/". This only performs a string based analysis of the path. No checks are done to make sure the path actually makes sense from the file system perspective.
* Fixed two buffer handling errors in vector.cAlex Budovski2011-01-081-0/+27
| | | | | | | - remove() would read one-past array bounds. - resize() would fail if the initial size was 1, because it multiplied by 1.75 and truncated the resulting value. The buffer would always remain at size 1, but elements would repeatedly be appended (via insert()) causing a crash.
* Remove git_errnoVicent Marti2010-12-231-12/+0
| | | | | | | | | It was not being used by any methods (only by malloc and calloc), and since it needs to be TLS, it cannot be exported on DLLs on Windows. Burn it with fire. The API always returns error codes! Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Rename 'git_person' to 'git_signature'Vicent Marti2010-12-184-67/+55
| | | | | | | The new signature struct is public, and contains information about the timezone offset. Must be free'd manually by the user. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Merge branch 'timezone-offset' of https://github.com/nulltoken/libgit2 into ↵Vicent Marti2010-12-122-13/+54
|\ | | | | | | timezone
| * Added more person parsing tests.nulltoken2010-12-111-0/+32
| |
| * Added timezone checks to person parsing tests.nulltoken2010-12-111-10/+16
| |
| * Fixed too much faked timezone offset.nulltoken2010-12-111-1/+1
| | | | | | | | An offset of more than 14 hours makes no sense (cf. http://www.worldtimezone.com/faq.html).
| * Added timezone offset parsing and outputting.nulltoken2010-12-101-2/+5
| |
* | Minor modifications for MinGW/Cygwin compatibility.Peter Drahos2010-12-121-2/+2
|/
* Tests now run with the resources folder as a hardcoded pathVicent Marti2010-12-104-9/+4
| | | | | | | Each tests expects a "TEST_RESOURCES" define with the full path to the resources folder. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Fix type-conversion warningsVicent Marti2010-12-061-1/+1
| | | | | | | The types in the git_index_entry struct are now system-defaults, and get truncated to uint32_t's when written back on the index. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Change the library include fileVicent Marti2010-12-0624-45/+45
| | | | | | | | | | | | Libgit2 is now officially include as #include "<git2.h>" or indidividual files may be included as #include <git2/index.h> Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Change include structure for the projectVicent Marti2010-12-063-41/+40
| | | | | | | | | | | The maze with include dependencies has been fixed. There is now a global include: #include <git.h> The git_odb_backend API has been exposed. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Decouple storage from ODB logicVicent Marti2010-12-068-98/+98
| | | | | | Comes with two default backends: loose object and packfiles. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Fix segfault in t0603 (unitialized pointer)Vicent Marti2010-12-021-2/+2
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Fix segfault handler in Mac OS XVicent Marti2010-12-021-39/+9
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Commit parents now use the common 'vector' codeVicent Marti2010-12-021-1/+1
| | | | | | No more linked lists, no more O(n) access. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Merge branch 'commitparents' of https://github.com/JustinLove/libgit2 into ↵Vicent Marti2010-12-021-0/+10
|\ | | | | | | JustinLove-commitparents
| * add git_commit_parent to retrieve a parent by indexJustin Love2010-11-301-1/+8
| |
| * add git_commit_parentcountJustin Love2010-11-301-0/+3
| |
* | Refactor all 'vector' functions into common codeVicent Marti2010-12-022-14/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All the operations on the 'git_index_entry' array and the 'git_tree_entry' array have been refactored into common code in the src/vector.c file. The new vector methods support: - insertion: O(1) (avg) - deletion: O(n) - searching: O(logn) - sorting: O(logn) - r. access: O(1) Signed-off-by: Vicent Marti <tanoku@gmail.com>
* | Add stack trace to the tests when building with GCCVicent Marti2010-12-021-0/+60
|/ | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Remove the Makefile from the tests/ folder tooVicent Marti2010-11-241-133/+0
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>