- 10 May, 2011 7 commits
-
-
Vicent Marti committed
-
We cannot totally deprecate this until the new error handling mechanisms are all in place.
Vicent Marti committed -
Fix issue #79 - git_lasterror() isn't appearing in git2.dll in windows.
Vicent Martí committed -
Move signature.c and tag.c to the new error handling
Vicent Martí committed -
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto committed -
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto committed -
The GIT_EXPORT macro is used to declare a function to be externally accessible to other libraries. This commit uses GIT_EXPORT to declare the git_lasterror() function as externally exported. I verified with depends.exe that the function is available to external callers (i.e. in the exports table of the PE file).
kelly.leahy committed
-
- 09 May, 2011 5 commits
-
-
Vicent Marti committed
-
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 committed -
Vicent Marti committed
-
Vicent Marti committed
-
Vicent Marti committed
-
- 08 May, 2011 7 commits
-
-
Fix misspelling of git_index_append2 (was git_index_apppend2).
Vicent Martí committed -
ref test: update a forgotten repo -> repo2
Vicent Martí committed -
odb backend_sort_cmp should be static
Vicent Martí committed -
Fix bug in the way pthead_mutex_t was being destroyed in win32.
Vicent Martí committed -
Add git attributes settings for *.c and *.h to force line endings to LF.
Scott Chacon committed -
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).
kelly.leahy committed -
kelly.leahy committed
-
- 06 May, 2011 3 commits
-
-
Fix two warnings from Clang. Fixes issue #173
Vicent Martí committed -
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 committed -
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto committed
-
- 05 May, 2011 1 commit
-
-
Commit 34e5d87e left one of these unchanged we're trying to read from a free'd repository. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto committed
-
- 04 May, 2011 1 commit
-
-
Jason R. McNeil committed
-
- 02 May, 2011 2 commits
-
-
Support root commits
Vicent Martí committed -
Fix tree-entry attribute convertion (fix corrupted trees)
Vicent Martí committed
-
- 01 May, 2011 6 commits
-
-
Vicent Marti committed
-
Fix -Wunused-but-set-variable warnings
Vicent Martí committed -
Fix memory leak in pack_backend__free
Vicent Martí committed -
Isolate "writing" refs tests in a temporary folder
Vicent Martí committed -
Change implementation of refs tests that alter the current repository to make them run against a temporary clone of the test repository
nulltoken committed -
Do not check the folder's size to detect new packfiles at runtime. This doesn't work on Win32.
Vicent Marti committed
-
- 29 Apr, 2011 3 commits
-
-
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto committed -
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 committed -
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>
Carlos Martín Nieto committed
-
- 27 Apr, 2011 1 commit
-
-
Sergey Nikishin committed
-
- 26 Apr, 2011 2 commits
-
-
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.
Sergey Nikishin committed -
As of gcc 4.6 -Wall includes -Wunused-but-set-variable. Use GIT_UNUSED or remove actually unused variables to prevent those warnings.
schu committed
-
- 23 Apr, 2011 2 commits
-
-
index.h: Add IDXENTRY flags needed for index operations
Vicent Martí committed -
Fix memory leaks in the tests
Vicent Martí committed
-