Commit Graph

74 Commits

Author SHA1 Message Date
Vicent Marti
5de079b86d Change the object creation/lookup API
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>
2011-03-03 20:23:52 +02:00
Vicent Marti
3dccfed163 Cleanup the testing toolkit
Tests are now declared with detailed descriptions and a short test name:

	BEGIN_TEST(the_test0, "this is an example test that does something")
		...
	END_TEST

Modules are declared through a simple macro interface:

	BEGIN_MODULE(mod_name)
		ADD_TEST(the_test0);
		...
	END_MODULE

Error messages when tests fail have been greatly improved.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-03 20:23:52 +02:00
nulltoken
8fc050961c Add test deleteref::deleting_a_ref_which_is_both_packed_and_loose_should_remove_both_tracks_in_the_filesystem() 2011-03-03 20:23:52 +02:00
nulltoken
d561403f08 Add test for corner case in reference renaming 2011-03-03 20:23:52 +02:00
nulltoken
268bee3d4f Add test renameref::rename_a_loose_reference() 2011-03-03 20:23:52 +02:00
nulltoken
6b02b21516 Add test renameref::can_not_rename_a_reference_with_an_invalid_name() 2011-03-03 20:23:51 +02:00
nulltoken
65cc1f44e1 Add test renameref::can_not_rename_a_reference_with_an_invalid_name() 2011-03-03 20:23:51 +02:00
nulltoken
de05ff6c78 Add test renameref::renaming_a_packed_reference_makes_it_loose() 2011-03-03 20:23:51 +02:00
nulltoken
52b2c2092a Enhance the packrefs::create_packfile() test 2011-03-03 20:23:51 +02:00
nulltoken
e4029c5201 Added copydir_recurs() to test_helpers.c
Test helper function which recursively copies the content of a
directory. This function has been tweaked to prevent stack overflows by
reusing the same path buffers on all recursive calls.
2011-03-03 20:23:51 +02:00
nulltoken
c38f9013e4 Removed a duplicate constant. 2011-03-03 20:23:50 +02:00
Vicent Marti
87d3acf45e Finish the References API
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>
2011-03-03 20:23:50 +02:00
nulltoken
9b3985fa2f Slightly enhanced the readability of some reference related tests. 2011-03-03 20:23:49 +02:00
nulltoken
b0a8314340 Removed duplicate tests. 2011-03-03 20:23:49 +02:00
Vicent Marti
86194b2433 Split packed from unpacked references
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>
2011-03-03 20:23:49 +02:00
nulltoken
2de3b35cd4 Added test covering creation of nested symbolic references. 2011-03-03 20:23:49 +02:00
nulltoken
1d8cc73123 Refactored the reference creation API. 2011-03-03 20:23:49 +02:00
nulltoken
e1be102816 Added some more tests to ensure the correct behavior of git_reference__normalize_name(). 2011-03-03 20:23:48 +02:00
nulltoken
77600378db Fixed line endings (CRLF->LF). 2011-03-03 20:23:48 +02:00
nulltoken
aa2120e9da Added git_reference__normalize_name() along with tests. 2011-03-03 20:23:48 +02:00
Vicent Marti
995f9c34a5 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>
2011-02-09 12:43:19 +02:00
nulltoken
1b7124f849 Added tests exercising git_reference_write() to create a new symbolic reference and a new object id reference. 2011-02-07 21:24:52 +01:00
nulltoken
1af8c7488d Enforced refs handling tests.
- Added a test to ensure that a nested symbolic reference is properly resolved.
 - Added comparisons of object ids.
2011-02-05 15:24:08 +01:00
Vicent Marti
2a1732b439 Rewrite the unit testing suite
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>
2011-02-02 02:15:25 +02:00