Commit Graph

7 Commits

Author SHA1 Message Date
Vicent Marti
b29e8f1930 Return the created entry in git_tree_add_entry()
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>
2011-01-29 02:12:59 +02:00
Vicent Marti
44908fe763 Change the library include file
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>
2010-12-06 23:03:16 +02:00
Vicent Marti
1795f87952 Improve error handling
All initialization functions now return error codes instead of pointers.
Error codes are now properly propagated on most functions. Several new
and more specific error codes have been added in common.h

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-11-05 03:20:17 +02:00
Vicent Marti
6fd195d76c Change git_repository initialization to use a path
The constructor to git_repository is now called

	'git_repository_open(path)'

and takes a path to a git repository instead of an existing ODB object.
Unit tests have been updated accordingly and the two test repositories
have been merged into one.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-11-02 18:42:42 +02:00
Vicent Marti
585190183b Fix internal memory management on the library
String mememory is now managed in a much more sane manner.

Fixes include:

	- git_person email and name is no longer limited to 64 characters
	- git_tree_entry filename is no longer limited to 255 characters
	- raw objects are properly opened & closed the minimum amount of
	times required for parsing
	- unit tests no longer leak
	- removed 5 other misc memory leaks as reported by Valgrind
	- tree writeback no longer segfaults on rare ocassions

The git_person struct is no longer public. It is now managed by the
library, and getter methods are in place to access its internal
attributes.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-10-28 02:07:18 +03:00
Vicent Marti
e4def81aab Fix issue 3 (memory corruption resize_tree_array)
The tree array wasn't being initialized when instantiating a tree object
in memory instead of loading it from disk.

New unit tests added to check for the problem.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-10-08 13:52:17 +03:00
Vicent Marti
0ba7a03186 Add unit tests for object write-back
Basic write-back & in-memory editing for objects is now tested in t0403
(commits), t0802 (tags) and t0902 (trees).

Add new helper functions in test_helpers.c to remove the loose objects
created when doing write-back tests.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2010-10-07 00:42:55 +03:00