src


Log

Author Commit Date CI Message
Sebastian Schuberth 765fdf4a 2011-05-18T17:19:38 Use "__inline" instead of "inline" with MSVC MSVC supports "inline" only in C++ code, not in C code.
Sebastian Schuberth 07234716 2011-05-18T16:46:56 Define str(n)casecmp for MSVC MSVC has _str(n)icmp instead.
Vicent Marti 128d3731 2011-05-17T15:05:41 config_file: Fix compilation
Vicent Marti 6adcb5f3 2011-05-17T15:04:18 utils: Implement git__strndup
Vicent Marti b3d94069 2011-05-17T14:51:42 repository: Properly free the index on close
Vicent Marti 0da2c700 2011-05-17T15:09:30 utils: Move git__str[n]tolower
Carlos Martín Nieto 29dca088 2011-05-17T13:38:19 Move config to the new error methods Take this opportunity to fix an instance of returning GIT_EOBJCORRUPTED when malloc failed. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 94711cad 2011-05-17T12:12:59 Merge upstream/development
Vicent Marti 335d6c99 2011-05-17T01:46:07 cache: Drop cuckoo hashing Now we use a simple closed-addressing cache. Cuckoo hashing was creating too many issues with race conditions. Fuck that. Let's see what happens performance wise, we may have to roll back or come up with another way to implement an efficient multi-threaded cache.
Vicent Marti 3de79280 2011-05-17T00:51:52 cache: Fix deadlock Do not try to adquire the same node lock twice when the cuckoo hashing resolves to the same node.
Vicent Marti 5ca2f580 2011-05-15T23:48:05 Do not set error message on `GIT_EREVWALKOVER` This is not really an error, just a special return code to mark the end of an iteration.
Vicent Marti 7cadd1f6 2011-05-15T23:46:22 Check error code from `git_cache_init`
Vicent Marti 4edf3e09 2011-05-15T23:45:24 Return success code on `git_cache_init`
Vicent Martí 3fe2e770 2011-05-15T13:34:43 Merge pull request #184 from nulltoken/repo-error-handling Updated fileops.c and repository.c to new error handling mechanism
Shuhei Tanuma 71747bca 2011-05-15T20:07:54 fix git_otype typo when calling `git_odb_read_header`.
nulltoken 81201a4c 2011-05-15T06:57:34 Move cache.c to the new error handling
nulltoken 3abe3bba 2011-05-14T16:05:33 Move repository.c to the new error handling
nulltoken 77c3999c 2011-05-14T14:40:56 Move fileops.c to the new error handling
Vicent Martí f02f4b53 2011-05-13T15:25:19 Merge pull request #183 from schu/errors Replace errors
Vicent Marti 098173c5 2011-05-13T04:17:24 Check Redis replies for NULL
schu b51c9269 2011-05-11T14:44:44 Move revwalk.c to the new error handling Signed-off-by: schu <schu-github@schulog.org>
schu 86f5fa78 2011-05-11T14:00:38 Move vector.c to the new error handling Remove "redundant" check for v->_cmp in wrapper function git_vector_bsearch(). Signed-off-by: schu <schu-github@schulog.org>
schu d6de92b6 2011-05-11T12:40:04 Move tree.c to the new error handling Signed-off-by: schu <schu-github@schulog.org>
schu cbcaf0c0 2011-05-11T12:09:40 Move blob.c to the new error handling Signed-off-by: schu <schu-github@schulog.org>
Vicent Marti 6810bf28 2011-05-11T00:40:07 Move all error-related defines to `git2/errors.h`
Vicent Marti f4a936b5 2011-05-11T00:35:05 Bring back `git_strerror` We cannot totally deprecate this until the new error handling mechanisms are all in place.
Carlos Martín Nieto 44dc0d26 2011-05-10T18:56:44 Move tag.c to the new error handling Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 5de24ec7 2011-05-10T17:38:41 Move signature.c to the new error handling Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto c0335005 2011-05-06T12:42:47 Move config to a backend structure Configuration options can come from different sources. Currently, there is only support for reading them from a flat file, but it might make sense to read it from a database at some point. Move the parsing code into src/config_file.c and create an include file include/git2/config_backend.h to allow for other backends to be developed. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Marti 5711ca93 2011-05-09T21:58:26 Merge branch 'error-handling' into development
Vicent Marti fa59f18d 2011-05-09T20:54:04 Change error handling mechanism once again Ok, this is the real deal. Hopefully. Here's how it's going to work: - One main method, called `git__throw`, that sets the error code and error message when an error happens. This method must be called in every single place where an error code was being returned previously, setting an error message instead. Example, instead of: return GIT_EOBJCORRUPTED; Use: return git__throw(GIT_EOBJCORRUPTED, "The object is missing a finalizing line feed"); And instead of: [...] { error = GIT_EOBJCORRUPTED; goto cleanup; } Use: [...] { error = git__throw(GIT_EOBJCORRUPTED, "What an error!"); goto cleanup; } The **only** exception to this are the allocation methods, which return NULL on failure but already set the message manually. /* only place where an error code can be returned directly, because the error message has already been set by the wrapper */ if (foo == NULL) return GIT_ENOMEM; - One secondary method, called `git__rethrow`, which can be used to fine-grain an error message and build an error stack. Example, instead of: if ((error = foobar(baz)) < GIT_SUCCESS) return error; You can now do: if ((error = foobar(baz)) < GIT_SUCCESS) return git__rethrow(error, "Failed to do a major operation"); The return of the `git_lasterror` method will be a string in the shape of: "Failed to do a major operation. (Failed to do an internal operation)" E.g. "Failed to open the index. (Not enough permissions to access '/path/to/index')." NOTE: do not abuse this method. Try to write all `git__throw` messages in a descriptive manner, to avoid having to rethrow them to clarify their meaning. This method should only be used in the places where the original error message set by a subroutine is not specific enough. It is encouraged to continue using this style as much possible to enforce error propagation: if ((error = foobar(baz)) < GIT_SUCCESS) return error; /* `foobar` has set an error message, and we are just propagating it */ The error handling revamp will take place in two phases: - Phase 1: Replace all pieces of code that return direct error codes with calls to `git__throw`. This can be done semi-automatically using `ack` to locate all the error codes that must be replaced. - Phase 2: Add some `git__rethrow` calls in those cases where the original error messages are not specific enough. Phase 1 is the main goal. A minor libgit2 release will be shipped once Phase 1 is ready, and the work will start on gradually improving the error handling mechanism by refining specific error messages. OTHER NOTES: - When writing error messages, please refrain from using weasel words. They add verbosity to the message without giving any real information. (<3 Emeric) E.g. "The reference file appears to be missing a carriage return" Nope. "The reference file is missing a carriage return" Yes. - When calling `git__throw`, please try to use more generic error codes so we can eventually reduce the list of error codes to something more reasonable. Feel free to add new, more generic error codes if these are going to replace several of the old ones. E.g. return GIT_EREFCORRUPTED; Can be turned into: return git__throw(GIT_EOBJCORRUPTED, "The reference is corrupted");
Vicent Marti 5eb0fab8 2011-05-05T01:49:27 errors: Update external API with new `git_lasterror`
Vicent Marti 3f53c971 2011-05-05T01:20:27 errors: Set error messages on memory allocation
Vicent Marti 02f9e637 2011-05-05T01:12:17 errors: Add error handling function
Vicent Martí cd2cc2dc 2011-05-08T14:00:57 Merge pull request #170 from jasonrm/development Fix misspelling of git_index_append2 (was git_index_apppend2).
Vicent Martí 5f94b77c 2011-05-08T13:59:47 Merge pull request #174 from carlosmn/backend-static odb backend_sort_cmp should be static
kelly.leahy 16a5c304 2011-05-08T12:32:35 Fix bug in the way pthead_mutex_t was being destroyed in win32. Win32 critical section objects (CRITICAL_SECTION) are not kernel objects. Only kernel objects are destroyed by using CloseHandle. Critical sections are supposed to be deleted with the DeleteCriticalSection API (http://msdn.microsoft.com/en-us/library/ms682552(VS.85).aspx).
Carlos Martín Nieto d8e1d038 2011-05-06T12:47:21 Fix two warnings from Clang Both are about not reading the value stored in a variable. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 39e1032c 2011-05-06T12:43:37 odb backend_sort_cmp should be static Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto ca8d2dfc 2011-05-05T16:22:06 Merge remote-tracking branch 'upstream/development' into config
Carlos Martín Nieto 094aaaae 2011-05-05T15:16:15 config: store the section name separately The section and variable names use different rules, so store them as two different variables internally. This will simplify the configuration-writing code as well later on, but even with parsing, the code is simpler. Take this opportunity to add a variable to the list directly when parsing instead of passing through config_set.
Jason R. McNeil 773bc20d 2011-05-03T22:22:42 Fix misspelling of git_index_append2 (was git_index_apppend2).
Vicent Martí cc3b82e3 2011-05-02T15:29:50 Merge pull request #151 from carlosmn/root-commit. Support root commits
Vicent Martí fde97669 2011-05-02T15:26:16 Merge pull request #146 from nordsturm/fix_subtrees. Fix tree-entry attribute convertion (fix corrupted trees)
Vicent Marti 1648fbd3 2011-05-02T01:12:53 Re-apply missing patches
Vicent Martí d4ad0771 2011-05-01T14:59:50 Merge pull request #145 from schu/fix-unused-warnings. Fix -Wunused-but-set-variable warnings
Vicent Martí 273c8bc0 2011-05-01T14:59:11 Merge pull request #147 from nordsturm/fix_pack_backend_leak. Fix memory leak in pack_backend__free
Vicent Marti c7b79af3 2011-05-01T21:31:58 pack-odb: Check `mtime` instead of folder size Do not check the folder's size to detect new packfiles at runtime. This doesn't work on Win32.
Carlos Martín Nieto 8381238e 2011-04-27T14:59:59 commit: support a root commits A root commit is a commit whose branch (usually what HEAD points to) doesn't exist (yet). This situation can happen when the commit is the first after 1) a repository is initialized or 2) a orphan checkout has been performed. Take this opportunity to remove the symbolic link check, as git_reference_resolve works on OID refs as well. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 68a146c1 2011-04-29T11:45:42 refs: don't loose info on resolve error Typical use is git_reference_resolve(&ref, ref). Currently, if there is an error, ref will point to NULL, causing the user to lose that reference. Always update resolved_ref instead of just on finding an OID ref, storing the last valid reference in it. This change helps simplify the code for allowing root commits. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Sergey Nikishin ed6c462c 2011-04-27T17:30:45 Fix memory leak in pack_backend__free
Carlos Martín Nieto 0130d818 2011-04-27T11:20:38 Fix git__strntolower Obviously, the whole string should be lower-cased and not just the last char. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Sergey Nikishin 555ce568 2011-04-26T13:22:45 Fix tree-entry attribute convertion (fix corrupted trees) Magic constant replaced by direct to-string covertion because of: 1) with value length 6 (040000 - subtree) final tree will be corrupted; 2) for wrong values length <6 final tree will be corrupted too.
schu 402a47a7 2011-04-26T11:29:05 Fix -Wunused-but-set-variable warnings As of gcc 4.6 -Wall includes -Wunused-but-set-variable. Use GIT_UNUSED or remove actually unused variables to prevent those warnings.
Vicent Martí 7df49e9e 2011-04-23T14:36:01 Merged pull request #139 from jpfender/merge-head-file. refs: Allow MERGE_HEAD in normalize_name()
Vicent Marti f7a5058a 2011-04-24T00:31:43 index: Refactor add/replace methods Removed the optional `replace` argument, we now have 4 add methods: `git_index_add`: add or update from path `git_index_add2`: add or update from struct `git_index_append`: add without replacing from path `git_index_append2`: add without replacing from struct Yes, this breaks the bindings.
Vicent Martí f16c0a9d 2011-04-23T14:08:17 Merged pull request #140 from jpfender/insert-replace. index: Allow user to toggle whether to replace an index entry
Vicent Martí 5ba7c4cb 2011-04-23T14:01:01 Merged pull request #143 from nordsturm/fix_loop. Fix going into infinite loop in read_header_loose()
Vicent Marti 1d008781 2011-04-23T23:59:38 Fix conversion warning in MSVC
Sergey Nikishin a3ced637 2011-04-22T17:36:28 Fix going into infinite loop in read_header_loose() read_header_loose causes infinite loop on this file: $ cat ../libcppgit/bin/sample-repo/test_mailbox/.git/objects/8f/e274605cbc740a2a957f44b2722a8a73915a09 | base64 eAErKUpNVTAzYzA0MDAzMVHISUxKzSlmWLgkuyN5+rxr6juMPR2EmN8s7Vl9D6oiN7UkkcHJdLbl 7Z3N/oxfE0W8wrSbuFRkAwDFfBn1
Jakob Pfender 729b6f49 2011-04-21T10:40:54 index: Allow user to toggle whether to replace an index entry When in the middle of a merge, the index needs to contain several files with the same name. git_index_insert() used to prevent this by not adding a new entry if an entry with the same name already existed.
Jakob Pfender df30eac1 2011-04-21T10:38:37 refs: Allow MERGE_HEAD in normalize_name() Do not return with EINVALIDREFNAME when trying to normalize MERGE_HEAD's name.
Carlos Martín Nieto a68cf94b 2011-04-19T16:40:52 Fix const char ** warning Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto a99264bf 2011-04-19T16:34:22 config: allow uppercase number suffixes Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Marti 2571cc3c 2011-04-15T20:32:31 Close file descriptor when writing a blob
Vicent Marti 90d743cd 2011-04-15T15:12:37 Refresh the list of packfiles on each ODB query Fixes the issue where object lookups were failing right after a pull on an open repository.
Carlos Martín Nieto 1bfa053e 2011-04-13T21:57:35 Close an object in packed_find_peel Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Marti def3fef1 2011-04-12T15:52:34 Add `git_tag_list` Lists all the tag references in a repository using a custom callback. Includes unit tests courtesy of Emeric Fermas <3
Carlos Martín Nieto 52ca4f8a 2011-04-11T17:51:05 Use internal strtol Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 631752aa 2011-04-11T17:49:47 Fix number suffix detection Allow a number not to have a suffix. This broke when adding the suffixes. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 55c197cd 2011-04-11T17:41:21 Merge upstream/development
Jakob Pfender 1eb0f68e 2011-04-11T12:38:50 merge branch development
Vicent Marti a6359408 2011-04-10T12:23:55 Use Z_BEST_SPEED for filebuf deflating This is what Git uses by default for all deflating.
Vicent Marti 53b7560b 2011-04-09T16:16:09 Fix `time_t` conversion on Win32
Vicent Marti 14eb94ee 2011-04-09T16:06:17 Fix `gmtime` issues in Win32
Vicent Marti 8416c9ad 2011-04-09T15:31:12 Rename `git_signature_new_now` The new name is more cool.
Carlos Martín Nieto 9e9e6ae1 2011-04-05T16:15:54 Add API git_signature_new_now Most tags will have a timestamp of whenever the code is running and dealing with time and timezones is error-prone. Optimize for this case by adding a function which causes the signature to be created with a current timestamp. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 076141a1 2011-04-07T14:38:03 Add a few malloc checks Add checks to see if malloc failed when allocating the tag members and signature members. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
nulltoken 4a34b3a9 2011-04-09T15:49:44 Add two new accessors to the repository git_repository_path() and git_repository_workdir() respectively return the path to the git repository and the working directory. Those paths are absolute and normalized.
Vicent Marti c6e65aca 2011-04-09T15:22:11 Properly check `strtol` for errors We are now using a custom `strtol` implementation to make sure we're not missing any overflow errors.
Vicent Marti 41233c40 2011-04-08T12:42:18 Add new method `git_repository_is_empty`
Vicent Marti d79f1da6 2011-04-08T12:14:33 refs: Fix issue when packing weak tags Weak tags (e.g. tags that point directly to a normal object instead of a tag object) were failing to be packed.
Carlos Martín Nieto 6ac247b3 2011-04-06T11:59:40 tag: don't check twice if an object exists Remove the check in git_tag_create_frombuffer as it's done by tag_create already. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 7bc66a79 2011-04-06T10:58:14 tag: don't allow tags to non-existent objects These indicate an inconsistency in the repository which we've created, so don't allow them. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 81234673 2011-04-05T16:53:32 tag: discover the target type if needed Don't blindly pass the target type to git_tag_type2string as it will give an empty string on GIT_OBJ_ANY which would cause us to create an invalid tag object. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Sam 5924b282 2011-04-06T10:48:31 Added git_commit_tree_oid and git_commit_parent_oid.
Shuhei Tanuma 98ac6780 2011-04-06T02:22:24 fix git_treebuilder_insert probrem. couldn't add new entry when inserting new one with `git_treebuilder_insert`.
Vicent Marti 5868cd02 2011-04-08T03:28:38 Do not assert error codes on Hiredis backend We cannot assume that Redis is never going to return an error code; when Reddit fails, we cannot crash our library, we need to handle the crash gracefully. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Dmitry Kovega 8a64bc29 2011-04-03T21:43:51 redis backend
Carlos Martín Nieto b075b991 2011-04-07T16:54:10 Add getting and setting of long int variables long int is a safer type than int unless the user knows that the variable is going to be quite small. The code has been reworked to use strtol instead of the more complicated sscanf. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 7a4dfd60 2011-04-07T11:30:02 Simplify error path in config_set Many error paths freed their local data althought it is freed later on when the end of the function notices that there was an error. This can cause double frees and invalid memory access. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 493384e3 2011-04-07T11:24:16 config: make cvar_free behave more like other free functions Make cvar_free return void instad of the next element, as it was mostly a hack to make cvar_list_free shorter but it's now using the list macros. Also check if the input is NULL and return immediately in that case. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 6b45cb8a 2011-04-06T18:27:31 config: use and implement list macros Use list macros instead of manually changing the head and/or tail of the variable list.
Jakob Pfender fd279b26 2011-04-07T16:58:42 index.c: Correctly check whether index contains extended entries Although write_index() supports writing extended header versions for index, this was never done as there was no check for extended index entries. Introduce function is_index_extended() that checks whether an index contains extended entries and check whether an index is extended before writing it to disk, adjusting its version number if necessary.
Carlos Martín Nieto 0d280ea4 2011-04-06T16:31:06 config: use snprintf instead of sprintf Due to the preconditions, there should never be an error, but it pays to be paranoid. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 956ad0ed 2011-04-06T15:51:10 config: free the file buffer earlier There is no need to keep config file in memory until the the configuration is freed. Free the buffer immediately after the configuration has been parsed. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 8bd6c0ab 2011-04-06T15:49:29 Merge remote-tracking branch 'upstream/development' into config
Carlos Martín Nieto acab3bc4 2011-04-06T15:31:42 config: move str(n)tolower to the git__ namespace Non-static functions in a library should always have a prefix namespace. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto aa793424 2011-04-06T15:27:12 config: coding style fixes
Carlos Martín Nieto 6776fd51 2011-04-06T15:17:06 config: really compare the variable name case-insensitively Make cvar_name_match really compare the last part of the variable ignoring the case. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>