]> git.proxmox.com Git - libgit2.git/log
libgit2.git
13 years agoindex.h: Correct documentation for git_index_open_inrepo()
Jakob Pfender [Thu, 24 Mar 2011 12:48:22 +0000 (13:48 +0100)]
index.h: Correct documentation for git_index_open_inrepo()

Fix the doxygen comments for git_index_open_inrepo(). Previously they
referred to a param index_path and omitted index (probably a c&p
error).

13 years agoindex.c: Read index after initialization
Jakob Pfender [Thu, 24 Mar 2011 14:32:24 +0000 (15:32 +0100)]
index.c: Read index after initialization

The current behaviour of git_index_open{bare,inrepo}() is unexpected.
When an index is opened, an in-memory index object is created that is
linked to the index discovered by git_repository_open(). However, this
index object is empty, as the on-disk index is not read. To fully open
the on-disk index file, git_index_read() has to be called. This leads to
confusing behaviour. Consider the following code:

git_index *idx;
git_index_open_inrepo(&idx, repo);
git_index_write(idx);

You would expect this to have no effect, as the index is never
ostensibly manipulated. However, what actually happens is that the index
entries are removed from the on-disk index because the empty in-memory
index object created by open_inrepo() is written back to the disk.

This patch reads the index after opening it.

13 years agoadd go-git (Go bindings) to the readme
Scott Chacon [Thu, 24 Mar 2011 00:06:49 +0000 (17:06 -0700)]
add go-git (Go bindings) to the readme

13 years agoRemove circular dependency in includes
Vicent Marti [Wed, 23 Mar 2011 18:18:34 +0000 (20:18 +0200)]
Remove circular dependency in includes

13 years agoodb.h: Fix minor typo
Jakob Pfender [Wed, 23 Mar 2011 13:57:41 +0000 (14:57 +0100)]
odb.h: Fix minor typo

Fix a doxygen typo ("@para" instead of "@param") in odb.h

13 years agocommon.h: Fix minor typos
Jakob Pfender [Wed, 23 Mar 2011 11:35:08 +0000 (12:35 +0100)]
common.h: Fix minor typos

Fix a few minor typos in the documentation of the GIT_ERROR codes.

13 years agoImprove the ODB writing backend
Vicent Marti [Wed, 23 Mar 2011 16:44:53 +0000 (18:44 +0200)]
Improve the ODB writing backend

Temporary files when doing streaming writes are now stored inside the
Objects folder, to prevent issues when moving files between
disks/partitions.

Add support for block writes to the ODB again (for those backends that
cannot implement streaming).

13 years agoAdd Ocaml bindings to the readme
Vicent Marti [Wed, 23 Mar 2011 13:53:12 +0000 (15:53 +0200)]
Add Ocaml bindings to the readme

13 years agoDo not return on `void` helper methods
Vicent Marti [Wed, 23 Mar 2011 13:44:52 +0000 (15:44 +0200)]
Do not return on `void` helper methods

MSVC doesn't swallow that.

13 years agoRemove `git_repository_gc` from the headers
Vicent Marti [Wed, 23 Mar 2011 13:40:47 +0000 (15:40 +0200)]
Remove `git_repository_gc` from the headers

13 years agoAdd close wappers for commit, tree, tag and blob
Carlos Martín Nieto [Tue, 22 Mar 2011 15:15:50 +0000 (16:15 +0100)]
Add close wappers for commit, tree, tag and blob

In the same spirit that git_repository_lookup is no longer available,
add wrappers so the users don't have to cast when closing their
objects.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoFix compilation in MinGW
Vicent Marti [Tue, 22 Mar 2011 23:58:18 +0000 (01:58 +0200)]
Fix compilation in MinGW

13 years agoAdd test exercising the opening of an standard repository initialized by git
nulltoken [Sat, 5 Mar 2011 14:09:01 +0000 (15:09 +0100)]
Add test exercising the opening of an standard repository initialized by git

13 years agoAdd test exercising the opening of an empty bare repository initialized by git
nulltoken [Sat, 5 Mar 2011 13:33:31 +0000 (14:33 +0100)]
Add test exercising the opening of an empty bare repository initialized by git

13 years agoAdd remove_placeholders() test helper function which recursively removes marker files...
nulltoken [Sat, 5 Mar 2011 13:26:22 +0000 (14:26 +0100)]
Add remove_placeholders() test helper function which recursively removes marker files from a directory structure

13 years agoAdd empty bare and normal repos to test resources
Vicent Marti [Tue, 22 Mar 2011 22:21:30 +0000 (00:21 +0200)]
Add empty bare and normal repos to test resources

We have removed the hooks folder because it takes a lot of space

13 years agoAdd detection of incorrect usage to git__joinpath()
nulltoken [Sat, 19 Mar 2011 07:31:40 +0000 (08:31 +0100)]
Add detection of incorrect usage to git__joinpath()

13 years agoSlightly enforce copy_recurs() behavior
nulltoken [Sat, 19 Mar 2011 07:19:34 +0000 (08:19 +0100)]
Slightly enforce copy_recurs() behavior

The folder creation is now decorrelated from the recursive parsing of the source tree structure.

13 years agoImprove test coverage of new path prettifying behavior
nulltoken [Fri, 18 Mar 2011 21:27:15 +0000 (22:27 +0100)]
Improve test coverage of new path prettifying behavior

13 years agoFix detection of attempt to escape the root directory on Windows
nulltoken [Fri, 18 Mar 2011 18:10:36 +0000 (19:10 +0100)]
Fix detection of attempt to escape the root directory on Windows

13 years agoChange gitfo_prettify_dir_path() and gitfo_prettify_file_path() behavior
nulltoken [Fri, 18 Mar 2011 15:56:43 +0000 (16:56 +0100)]
Change gitfo_prettify_dir_path() and gitfo_prettify_file_path() behavior

Those functions now return prettified rooted path.

13 years agoMake gitfo_prettify_dir_path() and gitfo_prettify_file_path() no longer externalized
nulltoken [Thu, 17 Mar 2011 05:56:58 +0000 (06:56 +0100)]
Make gitfo_prettify_dir_path() and gitfo_prettify_file_path() no longer externalized

13 years agoAdd failing test for issue 84
nulltoken [Tue, 15 Mar 2011 21:07:01 +0000 (22:07 +0100)]
Add failing test for issue 84

see https://github.com/libgit2/libgit2/issues#issue/84

13 years agoFix gitfo_mv() behavior when running on Windows
nulltoken [Tue, 22 Mar 2011 18:45:01 +0000 (19:45 +0100)]
Fix gitfo_mv() behavior when running on Windows

When the system temporary folder is located on a different volume than the working directory into which libgit2 is executing, MoveFileEx() requires an additional flag.

13 years agoSwitch from time_t to git_time_t
nulltoken [Sun, 20 Mar 2011 17:36:25 +0000 (18:36 +0100)]
Switch from time_t to git_time_t

git_time_t is defined as a signed 64 integer. This allows a true predictable multiplatform behavior.

13 years agoCorrected the header include directory in doxygen conf
Tim Branyen [Tue, 22 Mar 2011 03:27:54 +0000 (23:27 -0400)]
Corrected the header include directory in doxygen conf

13 years agoAlways free the parents of a revwalk commit
Vicent Marti [Tue, 22 Mar 2011 18:26:01 +0000 (20:26 +0200)]
Always free the parents of a revwalk commit

Thanks to Carlos Martín Nieto for spotting this.

13 years agoAdd getters for `git_odb_object`
Vicent Marti [Mon, 21 Mar 2011 18:28:02 +0000 (20:28 +0200)]
Add getters for `git_odb_object`

13 years agoFix MSVC warnings when building threads
Vicent Marti [Mon, 21 Mar 2011 17:44:43 +0000 (19:44 +0200)]
Fix MSVC warnings when building threads

13 years agorefs loose_lookup: also free the buffer on success
Carlos Martín Nieto [Tue, 22 Mar 2011 11:47:53 +0000 (12:47 +0100)]
refs loose_lookup: also free the buffer on success

Free the ref_file buffer at the end of the function also on
success. This fixes a small memory leak.

13 years agoUpdate CMakeLists.txt to support threadsafe
Vicent Marti [Mon, 21 Mar 2011 17:39:06 +0000 (19:39 +0200)]
Update CMakeLists.txt to support threadsafe

13 years agoFix MSVC warnings
Vicent Marti [Mon, 21 Mar 2011 17:27:45 +0000 (19:27 +0200)]
Fix MSVC warnings

13 years agoI broke your bindings
Vicent Marti [Fri, 18 Mar 2011 17:38:49 +0000 (19:38 +0200)]
I broke your bindings

Hey. Apologies in advance -- I broke your bindings.

This is a major commit that includes a long-overdue redesign of the
whole object-database structure. This is expected to be the last major
external API redesign of the library until the first non-alpha release.

Please get your bindings up to date with these changes. They will be
included in the next minor release. Sorry again!

Major features include:

- Real caching and refcounting on parsed objects
- Real caching and refcounting on objects read from the ODB
- Streaming writes & reads from the ODB
- Single-method writes for all object types
- The external API is now partially thread-safe

The speed increases are significant in all aspects, specially when
reading an object several times from the ODB (revwalking) and when
writing big objects to the ODB.

Here's a full changelog for the external API:

blob.h
------

- Remove `git_blob_new`
- Remove `git_blob_set_rawcontent`
- Remove `git_blob_set_rawcontent_fromfile`
- Rename `git_blob_writefile` -> `git_blob_create_fromfile`
- Change `git_blob_create_fromfile`:
The `path` argument is now relative to the repository's working dir
- Add `git_blob_create_frombuffer`

commit.h
--------

- Remove `git_commit_new`
- Remove `git_commit_add_parent`
- Remove `git_commit_set_message`
- Remove `git_commit_set_committer`
- Remove `git_commit_set_author`
- Remove `git_commit_set_tree`

- Add `git_commit_create`
- Add `git_commit_create_v`
- Add `git_commit_create_o`
- Add `git_commit_create_ov`

tag.h
-----

- Remove `git_tag_new`
- Remove `git_tag_set_target`
- Remove `git_tag_set_name`
- Remove `git_tag_set_tagger`
- Remove `git_tag_set_message`

- Add `git_tag_create`
- Add `git_tag_create_o`

tree.h
------

- Change `git_tree_entry_2object`:
New signature is `(git_object **object_out, git_repository *repo, git_tree_entry *entry)`

- Remove `git_tree_new`
- Remove `git_tree_add_entry`
- Remove `git_tree_remove_entry_byindex`
- Remove `git_tree_remove_entry_byname`
- Remove `git_tree_clearentries`
- Remove `git_tree_entry_set_id`
- Remove `git_tree_entry_set_name`
- Remove `git_tree_entry_set_attributes`

object.h
------------

- Remove `git_object_new
- Remove `git_object_write`

- Change `git_object_close`:
This method is now *mandatory*. Not closing an object causes a
memory leak.

odb.h
-----

- Remove type `git_rawobj`
- Remove `git_rawobj_close`
- Rename `git_rawobj_hash` -> `git_odb_hash`
- Change `git_odb_hash`:
New signature is `(git_oid *id, const void *data, size_t len, git_otype type)`

- Add type `git_odb_object`
- Add `git_odb_object_close`

- Change `git_odb_read`:
New signature is `(git_odb_object **out, git_odb *db, const git_oid *id)`
- Change `git_odb_read_header`:
New signature is `(size_t *len_p, git_otype *type_p, git_odb *db, const git_oid *id)`
- Remove `git_odb_write`
- Add `git_odb_open_wstream`
- Add `git_odb_open_rstream`

odb_backend.h
-------------

- Change type `git_odb_backend`:
New internal signatures are as follows

int (* read)(void **, size_t *, git_otype *, struct git_odb_backend *, const git_oid *)
int (* read_header)(size_t *, git_otype *, struct git_odb_backend *, const git_oid *)
int (* writestream)(struct git_odb_stream **, struct git_odb_backend *, size_t, git_otype)
int (* readstream)( struct git_odb_stream **, struct git_odb_backend *, const git_oid *)

- Add type `git_odb_stream`
- Add enum `git_odb_streammode`

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoThread safe cache
Vicent Marti [Wed, 16 Mar 2011 19:35:51 +0000 (21:35 +0200)]
Thread safe cache

13 years agoFix headers for the new Revision Walker
Vicent Marti [Wed, 16 Mar 2011 21:59:09 +0000 (23:59 +0200)]
Fix headers for the new Revision Walker

The "oid.h" header is now included instead of "object.h".

The old "revwalk.h" header has been removed; it was empty.

13 years agoRefs are now always in-sync on disk
Vicent Marti [Wed, 16 Mar 2011 21:13:28 +0000 (23:13 +0200)]
Refs are now always in-sync on disk

13 years agoDefine NO_GZIP in zconf.h instead of at compile time
Vicent Marti [Wed, 16 Mar 2011 21:02:31 +0000 (23:02 +0200)]
Define NO_GZIP in zconf.h instead of at compile time

13 years agoChange the Revwalk reset behavior to the old version
Vicent Marti [Tue, 15 Mar 2011 23:53:25 +0000 (01:53 +0200)]
Change the Revwalk reset behavior to the old version

The `reset` call now removes the pushed commits so we can reuse
the revwalker. The API documentation has been updated with the details.

13 years agoFix signature in `git_repository_gc`
Vicent Marti [Tue, 15 Mar 2011 23:10:40 +0000 (01:10 +0200)]
Fix signature in `git_repository_gc`

The method returns an int with the amount of objects free'd

13 years agoExport `git_repository_gc` properly
Vicent Marti [Tue, 15 Mar 2011 23:07:06 +0000 (01:07 +0200)]
Export `git_repository_gc` properly

One of my brainfarts made me export it as `git_repository_close` instead
of GC. Duh.

13 years agoExport `git_strarray_free` instead of inlining
Vicent Marti [Tue, 15 Mar 2011 23:06:15 +0000 (01:06 +0200)]
Export `git_strarray_free` instead of inlining

That way non-C bindings can use it.

13 years agoProperly free commit a commit list in revwalk
Vicent Marti [Tue, 15 Mar 2011 23:04:17 +0000 (01:04 +0200)]
Properly free commit a commit list in revwalk

The commit list was not being properly free'd when a walk was stopped
halfway through.

13 years agoRevert changes in wscript file
Vicent Marti [Tue, 15 Mar 2011 19:19:02 +0000 (21:19 +0200)]
Revert changes in wscript file

13 years agoAdd proper threading support to libgit2
Vicent Marti [Tue, 15 Mar 2011 19:04:41 +0000 (21:04 +0200)]
Add proper threading support to libgit2

We now depend on libpthread on all Unix platforms (should be installed
by default) and use a simple wrapper for Windows threads under Win32.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoDo not segfault when listing unpacked references
Vicent Marti [Tue, 15 Mar 2011 17:55:01 +0000 (19:55 +0200)]
Do not segfault when listing unpacked references

13 years agoDebug assertion when using an initialized hashtable
Vicent Marti [Tue, 15 Mar 2011 17:54:45 +0000 (19:54 +0200)]
Debug assertion when using an initialized hashtable

13 years agoFix compilation warnings in ZLib (MSVC)
Vicent Marti [Tue, 15 Mar 2011 17:46:38 +0000 (19:46 +0200)]
Fix compilation warnings in ZLib (MSVC)

Yes, we are changing the Zlib code. This is dangerous and uncool.
Fortunately, these are just some implicit casts.

13 years agoRemove duplicate refs in `git_reference_listall`
Vicent Marti [Tue, 15 Mar 2011 03:38:50 +0000 (05:38 +0200)]
Remove duplicate refs in `git_reference_listall`

13 years agoUse a more sane zconf.f when building Zlib
Vicent Marti [Tue, 15 Mar 2011 02:03:54 +0000 (04:03 +0200)]
Use a more sane zconf.f when building Zlib

13 years agoAdd nodegit to the README
Vicent Marti [Tue, 15 Mar 2011 01:31:52 +0000 (03:31 +0200)]
Add nodegit to the README

13 years agoAdd ZLib as a built-in dependency
Vicent Marti [Tue, 15 Mar 2011 01:25:44 +0000 (03:25 +0200)]
Add ZLib as a built-in dependency

I don't know if this is good or bad. This lets libgit2 compile cleanly
on any platforms without any external dependencies, but adds a little
bit of bloat...

Let's test this out and see what happens.

13 years agoAdd test case for issue GH-86
Ben Noordhuis [Sun, 13 Mar 2011 23:33:45 +0000 (00:33 +0100)]
Add test case for issue GH-86

13 years agogit_object_lookup() should also check the type if the object comes from the cache
Ben Noordhuis [Sun, 13 Mar 2011 23:07:37 +0000 (00:07 +0100)]
git_object_lookup() should also check the type if the object comes from the cache

13 years agoSkip the optional header in packed-refs files
Vicent Marti [Tue, 15 Mar 2011 00:45:49 +0000 (02:45 +0200)]
Skip the optional header in packed-refs files

13 years agolibgit2 version 0.10.0, "very disco"
Vicent Marti [Mon, 14 Mar 2011 21:55:32 +0000 (23:55 +0200)]
libgit2 version 0.10.0, "very disco"

A version *so* awesome that needs 2 version bumps AND a codename.

Major features:

- New internal garbage collection (harder)
- Pack backend rewritten from scratch (better)
- Revision walker rewritten from scratch (faster)
- New object interdependency system (stronger)
- Unique OID shortener
- Reference listing

In honor of one heck of a music album, released ten years ago,
yesterday.

13 years agoFix the retarded object interdependency system
Vicent Marti [Sat, 12 Mar 2011 21:09:16 +0000 (23:09 +0200)]
Fix the retarded object interdependency system

It's no longer retarded. All object interdependencies are stored as OIDs
instead of actual objects. This should be hundreds of times faster,
specially on big repositories. Heck, who knows, maye it doesn't even
segfault -- wouldn't that be awesome?

What has changed on the API?

`git_commit_parent`, `git_commit_tree`, `git_tag_target` now return
their values through a pointer-to-pointer, and have an error code.

`git_commit_set_tree` and `git_tag_set_target` now return an error
code and may fail.

`git_repository_free__no_gc` has been deprecated because it's
stupid. Since there are no longer any interdependencies between
objects, we don't need internal reference counting, and GC
never fails or double-free's pointers.

`git_object_close` now does a very sane thing: marks an object
as unused. Closed objects will be eventually free'd from the
object cache based on LRU. Please use `git_object_close` from
the garbage collector `destroy` method on your bindings. It's
100% safe.

`git_repository_gc` is a new method that forces a garbage collector
pass through the repo, to free as many LRU objects as possible.
This is useful if we are running out of memory.

13 years agoAdd new method `git_reference_listall`
Vicent Marti [Sat, 12 Mar 2011 14:04:46 +0000 (16:04 +0200)]
Add new method `git_reference_listall`

Lists all the references in a repository. Listing may be filtered by
reference type.

This should applease Lord Clem.

13 years agoRewrite the Pack backend
Vicent Marti [Wed, 9 Mar 2011 23:06:24 +0000 (01:06 +0200)]
Rewrite the Pack backend

The new pack backend is an adaptation of the original git.git code in
`sha1_file.c`. It's slightly faster than the previous version and
severely less memory-hungry.

The call-stack of a normal pack backend query has been properly
documented in the top of the header for future reference. And by
properly I mean with ASCII diagrams 'n shit.

13 years agoRewrite the Revision Walker
Vicent Marti [Tue, 8 Mar 2011 12:57:03 +0000 (14:57 +0200)]
Rewrite the Revision Walker

The new revision walker uses an internal Commit object storage system,
custom memory allocator and much improved topological and time sorting
algorithms. It's about 20x times faster than the previous implementation
when browsing big repositories.

The following external API calls have changed:

`git_revwalk_next` returns an OID instead of a full commit object.
The initial call to `git_revwalk_next` is no longer blocking when
iterating through a repo with a time-sorting mode.

Iterating with Topological or inverted modes still makes the initial
call blocking to preprocess the commit list, but this block should be
mostly unnoticeable on most repositories (topological preprocessing
times at 0.3s on the git.git repo).

`git_revwalk_push` and `git_revwalk_hide` now take an OID instead
of a full commit object.

13 years agoAdd `git_oid_shorten` (unique OID minimzer)
Vicent Marti [Sat, 5 Mar 2011 21:54:49 +0000 (23:54 +0200)]
Add `git_oid_shorten` (unique OID minimzer)

Set of methods to find the minimal-length to uniquely identify every OID
in a list. Useful for GUI applications, commit logs and so on.

Includes stress test.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoUpdate README.md with new bindings
Vicent Marti [Mon, 7 Mar 2011 19:18:05 +0000 (21:18 +0200)]
Update README.md with new bindings

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoadd objective-git to readme
Tim Clem [Mon, 7 Mar 2011 18:13:56 +0000 (10:13 -0800)]
add objective-git to readme

13 years agoFix creation of deeply-rooted references
Vicent Marti [Sat, 5 Mar 2011 12:34:32 +0000 (14:34 +0200)]
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>
13 years agoUse memmove() in git__dirname and git__basename
Vicent Marti [Sat, 5 Mar 2011 11:58:47 +0000 (13:58 +0200)]
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>
13 years agoUse memmove() in git__joinpath for overlapping copies
Vicent Marti [Sat, 5 Mar 2011 11:56:14 +0000 (13:56 +0200)]
Use memmove() in git__joinpath for overlapping copies

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoChange interface for Tree Index attr (always unsigned)
Vicent Marti [Sat, 5 Mar 2011 11:45:05 +0000 (13:45 +0200)]
Change interface for Tree Index attr (always unsigned)

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoCheck for valid range of attributes for tree entry
Sakari Jokinen [Fri, 25 Feb 2011 17:05:29 +0000 (19:05 +0200)]
Check for valid range of attributes for tree entry

13 years agoChange the return type of `git_blob_rawcontent`
Vicent Marti [Sat, 5 Mar 2011 11:29:50 +0000 (13:29 +0200)]
Change the return type of `git_blob_rawcontent`

Should return `void *` for raw bytes.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoFix the opening of empty repositories
Vicent Marti [Sat, 5 Mar 2011 11:22:16 +0000 (13:22 +0200)]
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>
13 years agoclean up temp repo for t12-repo tests
Tim Clem [Sat, 5 Mar 2011 07:13:02 +0000 (23:13 -0800)]
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

13 years agoFix segmentation fault when freeing a repository
Vicent Marti [Fri, 4 Mar 2011 23:17:59 +0000 (01:17 +0200)]
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>
13 years agoFix 'possibly uninitialized variable' warning
Vicent Marti [Fri, 4 Mar 2011 13:23:52 +0000 (15:23 +0200)]
Fix 'possibly uninitialized variable' warning

13 years agoDon't use non-int bit fields
Vicent Marti [Fri, 4 Mar 2011 13:10:16 +0000 (15:10 +0200)]
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>
13 years agoFix compilation when using CMake in Windows
Vicent Marti [Thu, 3 Mar 2011 20:01:15 +0000 (22:01 +0200)]
Fix compilation when using CMake in Windows

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoFix compilation in MSVC
Vicent Marti [Thu, 3 Mar 2011 19:58:37 +0000 (21:58 +0200)]
Fix compilation in MSVC

MSVC cannot substract void pointers. Go figure.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoBump the version number to 0.8.0
Vicent Marti [Thu, 3 Mar 2011 18:23:04 +0000 (20:23 +0200)]
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>
13 years agoMove the external includes folder from `src` to `include`
Vicent Marti [Thu, 3 Mar 2011 18:20:45 +0000 (20:20 +0200)]
Move the external includes folder from `src` to `include`

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoFix several issues with refcounting
Vicent Marti [Mon, 28 Feb 2011 23:37:28 +0000 (01:37 +0200)]
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>
13 years agoDo not free the index if it's owned by a repository
Vicent Marti [Mon, 28 Feb 2011 14:54:13 +0000 (16:54 +0200)]
Do not free the index if it's owned by a repository

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoImplement reference counting for git_objects
Vicent Marti [Mon, 28 Feb 2011 14:51:17 +0000 (16:51 +0200)]
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>
13 years agoFix searching in git_vector
Vicent Marti [Mon, 28 Feb 2011 10:46:13 +0000 (12:46 +0200)]
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>
13 years agoChange the object creation/lookup API
Vicent Marti [Mon, 28 Feb 2011 10:12:26 +0000 (12:12 +0200)]
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>
13 years agoCleanup the testing toolkit
Vicent Marti [Thu, 3 Mar 2011 16:19:05 +0000 (18:19 +0200)]
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>
13 years agoAdd test deleteref::deleting_a_ref_which_is_both_packed_and_loose_should_remove_both_...
nulltoken [Thu, 3 Mar 2011 17:59:25 +0000 (19:59 +0200)]
Add test deleteref::deleting_a_ref_which_is_both_packed_and_loose_should_remove_both_tracks_in_the_filesystem()

13 years agoFix reference removal: remove packed refs together with loose ones
nulltoken [Thu, 3 Mar 2011 17:58:07 +0000 (19:58 +0200)]
Fix reference removal: remove packed refs together with loose ones

13 years agoAdd test for corner case in reference renaming
nulltoken [Thu, 3 Mar 2011 17:57:12 +0000 (19:57 +0200)]
Add test for corner case in reference renaming

13 years agoFix corner case in reference renaming
nulltoken [Thu, 3 Mar 2011 17:55:48 +0000 (19:55 +0200)]
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.

13 years agoAdd test renameref::rename_a_loose_reference()
nulltoken [Thu, 3 Mar 2011 17:54:34 +0000 (19:54 +0200)]
Add test renameref::rename_a_loose_reference()

13 years agoAdd new move function, `gitfo_mv_force`
Vicent Marti [Thu, 3 Mar 2011 17:53:17 +0000 (19:53 +0200)]
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>
13 years agoAdd test renameref::can_not_rename_a_reference_with_an_invalid_name()
nulltoken [Thu, 3 Mar 2011 17:43:47 +0000 (19:43 +0200)]
Add test renameref::can_not_rename_a_reference_with_an_invalid_name()

13 years agoFix refs renaming to prevent renaming with an invalid name
nulltoken [Thu, 3 Mar 2011 17:43:11 +0000 (19:43 +0200)]
Fix refs renaming to prevent renaming with an invalid name

13 years agoAdd test renameref::can_not_rename_a_reference_with_an_invalid_name()
nulltoken [Thu, 3 Mar 2011 17:42:11 +0000 (19:42 +0200)]
Add test renameref::can_not_rename_a_reference_with_an_invalid_name()

13 years agoFix reference renaming to prevent duplicated names
nulltoken [Thu, 3 Mar 2011 17:41:27 +0000 (19:41 +0200)]
Fix reference renaming to prevent duplicated names

13 years agoAdd test renameref::renaming_a_packed_reference_makes_it_loose()
nulltoken [Thu, 3 Mar 2011 17:40:01 +0000 (19:40 +0200)]
Add test renameref::renaming_a_packed_reference_makes_it_loose()

13 years agoFix reference renaming implementation to match standard git behavior
nulltoken [Thu, 3 Mar 2011 17:38:54 +0000 (19:38 +0200)]
Fix reference renaming implementation to match standard git behavior

13 years agoSlightly changed the behavior of git__joinpath() and git__joinpath_n().
nulltoken [Mon, 28 Feb 2011 21:21:18 +0000 (22:21 +0100)]
Slightly changed the behavior of git__joinpath() and git__joinpath_n().

13 years agoEnhance the packrefs::create_packfile() test
nulltoken [Thu, 3 Mar 2011 17:37:40 +0000 (19:37 +0200)]
Enhance the packrefs::create_packfile() test

13 years agoPrevent _dirent_loose_load() from choking on empty folders
nulltoken [Thu, 3 Mar 2011 17:36:54 +0000 (19:36 +0200)]
Prevent _dirent_loose_load() from choking on empty folders

13 years agoAdded copydir_recurs() to test_helpers.c
nulltoken [Mon, 28 Feb 2011 11:33:47 +0000 (12:33 +0100)]
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.

13 years agoRefactored some test related constants.
nulltoken [Mon, 28 Feb 2011 11:16:44 +0000 (12:16 +0100)]
Refactored some test related constants.