src/notes.c


Log

Author Commit Date CI Message
Russell Belfer 26c1cb91 2013-12-09T09:44:03 One more rename/cleanup for callback err functions
Russell Belfer f10d7a36 2013-12-06T15:53:26 Further callback error check style fixes Okay, I've decided I like the readability of this style much better so I used it everywhere.
Russell Belfer 9f77b3f6 2013-11-25T14:21:34 Add config read fns with controlled error behavior This adds `git_config__lookup_entry` which will look up a key in a config and return either the entry or NULL if the key was not present. Optionally, it can either suppress all errors or can return them (although not finding the key is not an error for this function). Unlike other accessors, this does not normalize the config key string, so it must only be used when the key is known to be in normalized form (i.e. all lower-case before the first dot and after the last dot, with no invalid characters). This also adds three high-level helper functions to look up config values with no errors and a fallback value. The three functions are for string, bool, and int values, and will resort to the fallback value for any error that arises. They are: * `git_config__get_string_force` * `git_config__get_bool_force` * `git_config__get_int_force` None of them normalize the config `key` either, so they can only be used for internal cases where the key is known to be in normal format.
Russell Belfer 25e0b157 2013-12-06T15:07:57 Remove converting user error to GIT_EUSER This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
Russell Belfer dab89f9b 2013-12-04T21:22:57 Further EUSER and error propagation fixes This continues auditing all the places where GIT_EUSER is being returned and making sure to clear any existing error using the new giterr_user_cancel helper. As a result, places that relied on intercepting GIT_EUSER but having the old error preserved also needed to be cleaned up to correctly stash and then retrieve the actual error. Additionally, as I encountered places where error codes were not being propagated correctly, I tried to fix them up. A number of those fixes are included in the this commit as well.
Russell Belfer cee695ae 2013-05-31T12:18:43 Make iterators use GIT_ITEROVER & smart advance 1. internal iterators now return GIT_ITEROVER when you go past the last item in the iteration. 2. git_iterator_advance will "advance" to the first item in the iteration if it is called immediately after creating the iterator, which allows a simpler idiom for basic iteration. 3. if git_iterator_advance encounters an error reading data (e.g. a missing tree or an unreadable file), it returns the error but also attempts to advance past the invalid data to prevent an infinite loop. Updated all tests and internal usage of iterators to account for these new behaviors.
Linquize 0cb16fe9 2013-05-15T20:26:55 Unify whitespaces to tabs
Russell Belfer 734c6fc1 2013-05-01T14:15:55 Report errors finding notes
Russell Belfer 169dc616 2013-03-05T16:10:05 Make iterator APIs consistent with standards The iterator APIs are not currently consistent with the parameter ordering of the rest of the codebase. This rearranges the order of parameters, simplifies the naming of a number of functions, and makes somewhat better use of macros internally to clean up the iterator code. This also expands the test coverage of iterator functionality, making sure that case sensitive range-limited iteration works correctly.
Nico von Geyso aa518c70 2013-03-06T22:51:20 added missing free for git_note in clar tests
Nico von Geyso f7b18502 2013-03-06T22:25:01 fixed minor issues with new note iterator * fixed style issues * use new iterator functions for git_note_foreach()
Nico von Geyso 1a90dcf6 2013-03-06T19:07:56 use git_note_iterator type instead of non-public git_iterator one
Nico von Geyso 6edb427b 2013-03-06T16:43:21 basic note iterator implementation * git_note_iterator_new() - create a new note iterator * git_note_next() - retrieves the next item of the iterator
Russell Belfer 56543a60 2013-02-15T16:02:45 Clear up warnings from cppcheck The cppcheck static analyzer generates warnings for a bunch of places in the libgit2 code base. All the ones fixed in this commit are actually false positives, but I've reorganized the code to hopefully make it easier for static analysis tools to correctly understand the structure. I wouldn't do this if I felt like it was making the code harder to read or worse for humans, but in this case, these fixes don't seem too bad and will hopefully make it easier for better analysis tools to get at any real issues.
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
Nikolai Vladimirov b60b4562 2013-01-03T16:31:36 add option to allow git note overwrite
Nikolai Vladimirov b421decc 2013-01-03T15:43:51 notes.c - whitespace fix
Nikolai Vladimirov 8716b499 2013-01-03T16:31:36 add option to allow git note overwrite
Nikolai Vladimirov 4a44087a 2013-01-03T15:43:51 notes.c - whitespace fix
Russell Belfer 9950d27a 2012-12-06T13:26:58 Clean up iterator APIs This removes the need to explicitly pass the repo into iterators where the repo is implied by the other parameters. This moves the repo to be owned by the parent struct. Also, this has some iterator related updates to the internal diff API to lay the groundwork for checkout improvements.
Ben Straub de70aea6 2012-12-03T12:41:50 Remove GIT_SIGNATURE_VERSION and friends
Ben Straub c7231c45 2012-11-30T16:31:42 Deploy GITERR_CHECK_VERSION
Ben Straub 4ec197f3 2012-11-30T12:52:42 Deploy GIT_SIGNATURE_INIT
Russell Belfer 2bd5998c 2012-11-27T14:47:39 Remove git_note_data structure
Ben Straub de5596bf 2012-11-26T20:09:38 API updates for notes.h/c.
Russell Belfer e120123e 2012-11-20T14:01:46 API review / update for tree.h
Ben Straub 2508cc66 2012-11-18T21:38:08 Rename ref and reflog apis for consistency
nulltoken 9d7ac675 2012-08-21T11:45:16 tree entry: rename git_tree_entry_attributes() into git_tree_entry_filemode()
nulltoken a7dbac0b 2012-08-17T21:10:32 filemode: deploy enum usage
Vicent Marti 51e1d808 2012-08-06T12:41:08 Merge remote-tracking branch 'arrbee/tree-walk-fixes' into development Conflicts: src/notes.c src/transports/git.c src/transports/http.c src/transports/local.c tests-clar/odb/foreach.c
Russell Belfer 5dca2010 2012-08-03T17:08:01 Update iterators for consistency across library This updates all the `foreach()` type functions across the library that take callbacks from the user to have a consistent behavior. The rules are: * A callback terminates the loop by returning any non-zero value * Once the callback returns non-zero, it will not be called again (i.e. the loop stops all iteration regardless of state) * If the callback returns non-zero, the parent fn returns GIT_EUSER * Although the parent returns GIT_EUSER, no error will be set in the library and `giterr_last()` will return NULL if called. This commit makes those changes across the library and adds tests for most of the iteration APIs to make sure that they follow the above rules.
nulltoken b8457baa 2012-07-24T07:57:58 portability: Improve x86/amd64 compatibility
Vicent Marti 0e2fcca8 2012-06-29T02:21:12 tree: Bring back `entry_bypath` Smaller, simpler, faster.
Michael Schubert dca6b228 2012-06-20T18:06:37 notes: fix memory leaks
Vicent Marti b93688d0 2012-06-19T02:33:03 Merge remote-tracking branch 'yorah/fix/notes-creation' into development Conflicts: src/notes.c
yorah a02e7249 2012-05-29T17:53:29 notes: simplify the handling of fanouts - Do not create new levels of fanout when creating notes from libgit2 - Insert a note in an existing matching fanout - Remove a note from an existing fanout - Cleanup git_note_read, git_note_remove, git_note_foreach, git_note_create methods in order use tree structures instead of tree_oids
Vicent Martí 3f035860 2012-06-07T22:43:03 misc: Fix warnings from PVS Studio trial
Vicent Martí 904b67e6 2012-05-18T01:48:50 errors: Rename error codes
Vicent Martí e172cf08 2012-05-18T01:21:06 errors: Rename the generic return codes
Vicent Martí 29e948de 2012-05-10T10:38:10 global: Change parameter ordering in API Consistency is good.
nulltoken ee7680d5 2012-05-16T21:21:24 notes: make git_note_foreach() callback signature easier to cope with from a binding perspective
Russell Belfer 58ffeb9c 2012-05-15T14:51:30 Fix notes to use new fixed iterator signature
nulltoken d5ed6348 2012-05-14T22:24:58 Fix compilation warnings
nulltoken 86ecd844 2012-05-08T17:58:40 notes: add git_notes_foreach()
Vicent Martí f95e8cc0 2012-05-05T14:18:10 notes: Cleanup error handling
Michael Schubert caea5e54 2012-04-29T18:42:42 notes: honor core.notesRef Setting core.notesRef allows to change the default notes reference used by Git. Check if set before using GIT_NOTES_DEFAULT_REF. Fixes #649.
Michael Schubert 630c5a4a 2012-04-30T14:29:34 notes: add git_note_default_ref() Add git_note_default_ref to allow easy retrieval of the currently set default notes reference.
Russell Belfer 4aa7de15 2012-03-19T17:49:46 Convert indexer, notes, sha1_lookup, and signature More files moved to new error handling style.
schu 0691966a 2012-02-16T11:48:14 notes: fix assert Hopefully fix issue "Don't sleep and code" - #558. Signed-off-by: schu <schu-github@schulog.org>
schu bf477ed4 2012-02-15T00:33:38 Add git notes API This commit adds basic git notes support to libgit2, namely: * git_note_read * git_note_message * git_note_oid * git_note_create * git_note_remove In the long run, we probably want to provide some convenience callback mechanism for merging and moving (filter-branch) notes. Signed-off-by: schu <schu-github@schulog.org>