]> git.proxmox.com Git - libgit2.git/log
libgit2.git
13 years agoconfig_set: really replace the value on overwrite
Carlos Martín Nieto [Thu, 31 Mar 2011 10:51:17 +0000 (12:51 +0200)]
config_set: really replace the value on overwrite

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agogit_config_set_int: use the right buffer
Carlos Martín Nieto [Wed, 30 Mar 2011 14:48:14 +0000 (16:48 +0200)]
git_config_set_int: use the right buffer

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agogit_config: reorder fields according to use
Carlos Martín Nieto [Wed, 30 Mar 2011 13:16:25 +0000 (15:16 +0200)]
git_config: reorder fields according to use

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoconfig: use a singly-linked list instead of a hash table
Carlos Martín Nieto [Wed, 30 Mar 2011 13:05:15 +0000 (15:05 +0200)]
config: use a singly-linked list instead of a hash table

Such a list preserves the order the variables were first read in which
will be useful later for merging different data-sets. Furthermore,
reading and writing out the same configuration should not reorganize
the variables, which could happen when iterating through all the items
in a hash table.

A hash table is overkill for this small a data-set anyway.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoStore the parsed variables
Carlos Martín Nieto [Wed, 30 Mar 2011 11:40:19 +0000 (13:40 +0200)]
Store the parsed variables

Store the key-value pair as strings.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoInitialise the config reader in config_parse
Carlos Martín Nieto [Wed, 30 Mar 2011 09:32:08 +0000 (11:32 +0200)]
Initialise the config reader in config_parse

git_config_open shouldn't have to initialise variables that are only
used inside config_parse and its callees.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoDetermine variable type at runtime
Carlos Martín Nieto [Wed, 30 Mar 2011 09:30:40 +0000 (11:30 +0200)]
Determine variable type at runtime

Config variables should be interpreted at run-time, as we don't know if a
zero means false or zero, or if yes means true or "yes".

As a variable has no intrinsic type, git_cvtype is gone and the public
API takes care of enforcing a few rules.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agobuild_varname: allocate memory
Carlos Martín Nieto [Wed, 30 Mar 2011 09:07:09 +0000 (11:07 +0200)]
build_varname: allocate memory

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoExpose config API for setters, getters and foreach
Carlos Martín Nieto [Tue, 29 Mar 2011 15:44:10 +0000 (17:44 +0200)]
Expose config API for setters, getters and foreach

These functions can be used to query or modify the variables in a
given configuration. No sanity checking is done on the variable names.

This is mostly meant as an API preview.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoAdd build_varname to make a full var name
Carlos Martín Nieto [Tue, 29 Mar 2011 15:59:13 +0000 (17:59 +0200)]
Add build_varname to make a full var name

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agocvar_free: also free the config var's name
Carlos Martín Nieto [Tue, 29 Mar 2011 15:37:03 +0000 (17:37 +0200)]
cvar_free: also free the config var's name

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoMove git_cvar_type to include/git2/config.h
Carlos Martín Nieto [Tue, 29 Mar 2011 15:35:02 +0000 (17:35 +0200)]
Move git_cvar_type to include/git2/config.h

Include it in src/config.h and fix the header name #define.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoFree the config var hash contents in git_config_free
Carlos Martín Nieto [Tue, 29 Mar 2011 11:50:37 +0000 (13:50 +0200)]
Free the config var hash contents in git_config_free

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoRename git_config_{type,var} to git_cvar{_type,}
Carlos Martín Nieto [Tue, 29 Mar 2011 10:29:21 +0000 (12:29 +0200)]
Rename git_config_{type,var} to git_cvar{_type,}

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoMake GIT_EINVALIDTYPE available for use in config
Carlos Martín Nieto [Tue, 29 Mar 2011 10:25:46 +0000 (12:25 +0200)]
Make GIT_EINVALIDTYPE available for use in config

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoDon't leak if config parsing fails
Carlos Martín Nieto [Tue, 29 Mar 2011 10:19:53 +0000 (12:19 +0200)]
Don't leak if config parsing fails

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoMove config to support the new hash code
Carlos Martín Nieto [Tue, 29 Mar 2011 10:10:30 +0000 (12:10 +0200)]
Move config to support the new hash code

The hashes have been copied from the references code

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoCorrectly parse the section header
Carlos Martín Nieto [Mon, 28 Mar 2011 16:07:22 +0000 (18:07 +0200)]
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>
13 years agoparse_section_header: save the name where it belongs
Carlos Martín Nieto [Mon, 28 Mar 2011 15:53:04 +0000 (17:53 +0200)]
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>
13 years agoRead and parse the confguration when openingt the config file
Carlos Martín Nieto [Mon, 28 Mar 2011 15:51:18 +0000 (17:51 +0200)]
Read and parse the confguration when openingt the config file

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoConvert config.c to LF
Carlos Martín Nieto [Mon, 28 Mar 2011 15:12:53 +0000 (17:12 +0200)]
Convert config.c to LF

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoMove the struct declaration outside config.c
Carlos Martín Nieto [Mon, 28 Mar 2011 15:02:45 +0000 (17:02 +0200)]
Move the struct declaration outside config.c

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoFirst version - WIP
Vicent Marti [Fri, 28 Jan 2011 23:58:55 +0000 (01:58 +0200)]
First version - WIP

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoFix type-conversion warning in MSVC
Vicent Marti [Sat, 5 Mar 2011 22:03:31 +0000 (00:03 +0200)]
Fix type-conversion warning in MSVC

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoAdd `git_oid_shorten`
Vicent Marti [Sat, 5 Mar 2011 21:54:49 +0000 (23:54 +0200)]
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>
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.

13 years agoAdded tests to exercise the initialization and the opening of a repository.
nulltoken [Sat, 26 Feb 2011 13:07:13 +0000 (14:07 +0100)]
Added tests to exercise the initialization and the opening of a repository.

13 years agoRemoved a duplicate constant.
nulltoken [Sat, 26 Feb 2011 12:56:57 +0000 (13:56 +0100)]
Removed a duplicate constant.

13 years agoRefactored the opening and the initialization of a repository.
nulltoken [Sat, 26 Feb 2011 12:56:16 +0000 (13:56 +0100)]
Refactored the opening and the initialization of a repository.

13 years agoAdded rmdir_recurs(), a test helper function which recursively removes the content...
nulltoken [Fri, 25 Feb 2011 20:58:25 +0000 (21:58 +0100)]
Added rmdir_recurs(), a test helper function which recursively removes the content of a directory.

13 years agoAdded some dirname and basename tests to ensure that trailing slashes are ignored.
nulltoken [Fri, 25 Feb 2011 14:09:31 +0000 (15:09 +0100)]
Added some dirname and basename tests to ensure that trailing slashes are ignored.

13 years agoFinish the References API
Vicent Marti [Sun, 27 Feb 2011 20:31:43 +0000 (22:31 +0200)]
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>
13 years agoMake some Object methods take a const parameter
Vicent Marti [Sun, 27 Feb 2011 20:31:06 +0000 (22:31 +0200)]
Make some Object methods take a const parameter

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoAdd extra methods to the new Hashtable implementation
Vicent Marti [Sun, 27 Feb 2011 20:30:28 +0000 (22:30 +0200)]
Add extra methods to the new Hashtable implementation

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoMove the path comparison method to fileops.c
Vicent Marti [Sun, 27 Feb 2011 20:09:36 +0000 (22:09 +0200)]
Move the path comparison method to fileops.c

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoFix warnings in vector.c
Vicent Marti [Sun, 27 Feb 2011 20:07:39 +0000 (22:07 +0200)]
Fix warnings in vector.c

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoSlightly enhanced the readability of some reference related tests.
nulltoken [Fri, 25 Feb 2011 09:29:11 +0000 (10:29 +0100)]
Slightly enhanced the readability of some reference related tests.

13 years agoRemoved duplicate tests.
nulltoken [Fri, 25 Feb 2011 09:06:49 +0000 (10:06 +0100)]
Removed duplicate tests.

13 years agoSplit packed from unpacked references
Vicent Marti [Fri, 18 Feb 2011 19:57:53 +0000 (21:57 +0200)]
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>
13 years agoBrush up the refs API
Vicent Marti [Fri, 18 Feb 2011 16:09:19 +0000 (18:09 +0200)]
Brush up the refs API

Changed some more API details and updated documentation.

Sketched API for addition/removal of entries.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoAdded test covering creation of nested symbolic references.
nulltoken [Mon, 14 Feb 2011 21:32:02 +0000 (22:32 +0100)]
Added test covering creation of nested symbolic references.

13 years agoRefactored the reference creation API.
nulltoken [Mon, 14 Feb 2011 21:29:22 +0000 (22:29 +0100)]
Refactored the reference creation API.

13 years agoAdded some more tests to ensure the correct behavior of git_reference__normalize_name().
nulltoken [Sun, 13 Feb 2011 19:18:35 +0000 (20:18 +0100)]
Added some more tests to ensure the correct behavior of git_reference__normalize_name().

13 years agoFixed line endings (CRLF->LF).
nulltoken [Sun, 13 Feb 2011 13:51:45 +0000 (14:51 +0100)]
Fixed line endings (CRLF->LF).

13 years agoAdded GIT_EINVALIDREFSTATE error.
nulltoken [Fri, 11 Feb 2011 12:58:40 +0000 (13:58 +0100)]
Added GIT_EINVALIDREFSTATE error.

13 years agoAdded git_reference__normalize_name() along with tests.
nulltoken [Thu, 10 Feb 2011 14:08:00 +0000 (15:08 +0100)]
Added git_reference__normalize_name() along with tests.

13 years agoFix check for bad --sha1 option argument
antong [Wed, 2 Mar 2011 19:02:22 +0000 (11:02 -0800)]
Fix check for bad --sha1 option argument

13 years agoAdd missing include to odb_backends.h
Vicent Marti [Tue, 1 Mar 2011 20:15:20 +0000 (22:15 +0200)]
Add missing include to odb_backends.h

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoinclude "oid.h" in headers that use git_oid
Sakari Jokinen [Wed, 23 Feb 2011 05:08:50 +0000 (07:08 +0200)]
include "oid.h" in headers that use git_oid

This makes generating bindings to hlibgit2 easier

13 years agoFix file renaming in MinGW
Vicent Marti [Thu, 24 Feb 2011 21:53:40 +0000 (23:53 +0200)]
Fix file renaming in MinGW

We now use MoveFileEx, which is not assured to be atomic but works for
always (both if the destination exists, or if it doesn't) and is
available in MinGW.

Since this is a Win32 API call, complaint about lost or overwritten files
should be forwarded at Steve Ballmer.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoFix renaming of files in Win32
Vicent Marti [Thu, 24 Feb 2011 19:43:08 +0000 (21:43 +0200)]
Fix renaming of files in Win32

The `rename` call doesn't quite work on Win32: expects the destination
file to not exist. We're using a native Win32 call in those cases --
that should do the trick.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoFix double-freeing file descriptors
Vicent Marti [Thu, 24 Feb 2011 17:31:12 +0000 (19:31 +0200)]
Fix double-freeing file descriptors

Was crashing the Windows build.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoRewrite git_hashtable internals
Vicent Marti [Tue, 22 Feb 2011 19:59:36 +0000 (21:59 +0200)]
Rewrite git_hashtable internals

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>
13 years agoAdd unit test for writing a big index file
Vicent Marti [Tue, 22 Feb 2011 13:15:35 +0000 (15:15 +0200)]
Add unit test for writing a big index file

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoAdd printf method to the File Buffer
Vicent Marti [Tue, 22 Feb 2011 12:58:54 +0000 (14:58 +0200)]
Add printf method to the File Buffer

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoAdd --without-sqlite option to waf configure
Olivier Ramonat [Mon, 21 Feb 2011 12:14:01 +0000 (13:14 +0100)]
Add --without-sqlite option to waf configure

Disable sqlite support when ./waf configure is run with --without-sqlite

13 years agoRewrite all file IO for more performance
Vicent Marti [Mon, 21 Feb 2011 15:05:16 +0000 (17:05 +0200)]
Rewrite all file IO for more performance

The new `git_filebuf` structure provides atomic high-performance writes
to disk by using a write cache, and optionally a double-buffered scheme
through a worker thread (not enabled yet).

Writes can be done 3-layered, like in git.git (user code -> write cache
-> disk), or 2-layered, by writing directly on the cache. This makes
index writing considerably faster.

The `git_filebuf` structure contains all the old functionality of
`git_filelock` for atomic file writes and reads. The `git_filelock`
structure has been removed.

Additionally, the `git_filebuf` API allows to automatically hash (SHA1)
all the data as it is written to disk (hashing is done smartly on big
chunks to improve performance).

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoFix repository initialization
Vicent Marti [Fri, 18 Feb 2011 12:11:53 +0000 (14:11 +0200)]
Fix repository initialization

Fixed several issues with path joining and bare repos.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoFix segfault when iterating a revlist backwards
Vicent Marti [Fri, 18 Feb 2011 10:23:53 +0000 (12:23 +0200)]
Fix segfault when iterating a revlist backwards

The `prev` and `next` pointers were not being updated after popping one
of the list elements.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoDisable threaded index writing by default
Vicent Marti [Fri, 18 Feb 2011 08:29:55 +0000 (10:29 +0200)]
Disable threaded index writing by default

The interlocking on the write threads was not being done properly (index
entries were sometimes written out of order). With proper interlocking,
the threaded write is only marginally faster on big index files, and
slower on the smaller ones because of the overhead when creating
threads.

The threaded index writing has been temporarily disabled; after more
accurate benchmarks, if might be possible to enable it again only when
writing very large index files (> 1000 entries).

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoFix refcounting initialization
Vicent Marti [Thu, 17 Feb 2011 22:08:34 +0000 (00:08 +0200)]
Fix refcounting initialization

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoFix type truncation in index entries
Vicent Marti [Thu, 17 Feb 2011 21:32:22 +0000 (23:32 +0200)]
Fix type truncation in index entries

64-bit types stored in memory have to be truncated into 32 bits when
writing to disk. Was causing warnings in MSVC.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
13 years agoImprove the performance when writing Index files
Vicent Marti [Thu, 17 Feb 2011 19:32:00 +0000 (21:32 +0200)]
Improve the performance when writing Index files

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>