Commit Graph

575 Commits

Author SHA1 Message Date
Carlos Martín Nieto
3b4835c25a Correctly parse the section header
If cfg_readline consumes the line, then parse_section_header will read
past it and if we read a character, parse_variable won't have the full
name.

This solution is a bit hackish, but it's the simplest way to get the
code to parse correctly.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-28 18:07:22 +02:00
Carlos Martín Nieto
908afb771a parse_section_header: save the name where it belongs
Save the location of the name in section_out instead of returning it
as an int. Use the return code to signal success or failure.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-28 17:53:04 +02:00
Carlos Martín Nieto
e4c796f1a2 Read and parse the confguration when openingt the config file
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-28 17:51:18 +02:00
Carlos Martín Nieto
a69053c715 Convert config.c to LF
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-28 17:12:53 +02:00
Carlos Martín Nieto
5d4cd00305 Move the struct declaration outside config.c
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-28 17:03:08 +02:00
Vicent Marti
a3002d5694 First version - WIP
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-06 00:21:48 +02:00
Vicent Marti
86627121c8 Fix type-conversion warning in MSVC
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-06 00:03:31 +02:00
Vicent Marti
d6b5f5cca9 Add git_oid_shorten
Set of methods to find the minimal-length to uniquely identify every OID
in a list.

Includes stress test.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-05 23:54:49 +02:00
Vicent Marti
55ffebe377 Fix creation of deeply-rooted references
Use a new `gitfo_creat_force` that will create the full path to a file
before creating it.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-05 14:34:32 +02:00
Vicent Marti
246eba80af Use memmove() in git__dirname and git__basename
We cannot make sure that the user doesn't use the same buffer as source
and destination, so write to it using memmove.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-05 13:58:47 +02:00
Vicent Marti
60cb1d10b3 Use memmove() in git__joinpath for overlapping copies
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-05 13:56:14 +02:00
Vicent Marti
545a6915eb Change interface for Tree Index attr (always unsigned)
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-05 13:46:37 +02:00
Sakari Jokinen
9de27ad0c4 Check for valid range of attributes for tree entry 2011-03-05 13:46:27 +02:00
Vicent Marti
3490188b3c Change the return type of git_blob_rawcontent
Should return `void *` for raw bytes.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-05 13:29:50 +02:00
Vicent Marti
e0011be330 Fix the opening of empty repositories
We were checking for the index file, which is not assured to exist on
clean git repositories.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-05 13:22:16 +02:00
Tim Clem
45314a7e4a clean up temp repo for t12-repo tests
add actual must_pass calls back into the repo tests and remove ./ from
beginning of temp repo path
2011-03-04 23:31:28 -08:00
Vicent Marti
f335b42c72 Fix segmentation fault when freeing a repository
Disable garbage collection of cross-references to prevent
double-freeing. Internal reference management is now done
with a separate method.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-05 02:05:26 +02:00
Vicent Marti
e06dd9b6d6 Fix 'possibly uninitialized variable' warning 2011-03-04 15:23:52 +02:00
Vicent Marti
f7fcb0dd1b Don't use non-int bit fields
They are not standard. MSVC complains about them. And that's not good.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-04 15:10:16 +02:00
Vicent Marti
c3a41e5f14 Fix compilation when using CMake in Windows
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-03 22:01:15 +02:00
Vicent Marti
3c41c635fb Fix compilation in MSVC
MSVC cannot substract void pointers. Go figure.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-03 21:58:37 +02:00
Vicent Marti
b64e11d1fe Bump the version number to 0.8.0
Yes, these are some seriously massive changes to the external API. We
are breaking stuff.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-03 20:23:53 +02:00
Vicent Marti
71d33382a7 Move the external includes folder from src to include
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-03 20:23:53 +02:00
Vicent Marti
584f49a5ce Fix several issues with refcounting
- Added several missing reference increases
- Add new destructor to the repository that does not GC the objects

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-03 20:23:53 +02:00
Vicent Marti
971c90befe Do not free the index if it's owned by a repository
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-03 20:23:52 +02:00
Vicent Marti
48c27f86bb Implement reference counting for git_objects
All `git_object` instances looked up from the repository are reference
counted. User is expected to use the new `git_object_close` when an
object is no longer needed to force freeing it.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-03 20:23:52 +02:00
Vicent Marti
86d7e1ca6f Fix searching in git_vector
We now store only one sorting callback that does entry comparison. This
is used when sorting the entries using a quicksort, and when looking for
a specific entry with the new search methods.

The following search methods now exist:

	git_vector_search(vector, entry)
	git_vector_search2(vector, custom_search_callback, key)

	git_vector_bsearch(vector, entry)
	git_vector_bsearch2(vector, custom_search_callback, key)

The sorting state of the vector is now stored internally.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-03 20:23:52 +02:00
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
5ad0351db1 Fix reference removal: remove packed refs together with loose ones 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
8f90ced5ed Fix corner case in reference renaming
Renaming a packed reference should not pack another reference
which happens to be in both loose and pack state.
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
Vicent Marti
19a30a3f6e Add new move function, gitfo_mv_force
Forces a move by creating the folder for the destination file, if it
doesn't exist.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-03 20:23:51 +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
129007b423 Fix refs renaming to prevent renaming 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
e2d426227f Fix reference renaming to prevent duplicated names 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
76f7cf7075 Fix reference renaming implementation to match standard git behavior 2011-03-03 20:23:51 +02:00
nulltoken
669db21b28 Slightly changed the behavior of git__joinpath() and git__joinpath_n(). 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
0594e3efb7 Prevent _dirent_loose_load() from choking on empty folders 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
7167422cbf Refactored some test related constants. 2011-03-03 20:23:50 +02:00
nulltoken
705a90ec9e Added tests to exercise the initialization and the opening of a repository. 2011-03-03 20:23:50 +02:00
nulltoken
c38f9013e4 Removed a duplicate constant. 2011-03-03 20:23:50 +02:00
nulltoken
d2d6912e6c Refactored the opening and the initialization of a repository. 2011-03-03 20:23:50 +02:00
nulltoken
3b3a10176e Added rmdir_recurs(), a test helper function which recursively removes the content of a directory. 2011-03-03 20:23:50 +02:00