1. 13 Dec, 2013 2 commits
    • pool: Correct overflow checks · 437f7d69
      Ok, scrap the previous commit. This is the right overflow check that
      takes care of 64 bit overflow **and** 32-bit overflow, which needs to be
      considered because the pool malloc can only allocate 32-bit elements in
      one go.
      Vicent Marti committed
    • pool: Cleanup error handling in pool_strdup · ce33645f
      Note that `git_pool_strdup` cannot really return any error codes,
       because the pool doesn't set errors on OOM.
      
       The only place where `giterr_set_oom` is called is in
       `git_pool_strndup`, in a conditional check that is always optimized
       away. `n + 1` cannot be zero if `n` is unsigned because the compiler
       doesn't take wraparound into account.
      
       This check has been removed altogether because `size_t` is not
       particularly going to overflow.
      Vicent Marti committed
  2. 12 Dec, 2013 4 commits
  3. 11 Dec, 2013 18 commits
    • Test cancel from indexer progress callback · 7697e541
      This adds tests that try canceling an indexer operation from
      within the progress callback.
      
      After writing the tests, I wanted to run this under valgrind and
      had a number of errors in that situation because mmap wasn't
      working.  I added a CMake option to force emulation of mmap and
      consolidated the Amiga-specific code into that new place (so we
      don't actually need separate Amiga code now, just have to turn on
      -DNO_MMAP).
      
      Additionally, I made the indexer code propagate error codes more
      reliably than it used to.
      Russell Belfer committed
    • More improvements to callback return value tests · 8b22d862
      This time actually checking return values in diff notify tests and
      actually testing callbacks for the index all-all/update-all/etc
      functions.
      Russell Belfer committed
    • Update clone doc and tests for callback return val · 8f1066a0
      Clone callbacks can return non-zero values to cancel the clone.
      This adds some tests to verify that this actually works and updates
      the documentation to be clearer that this can happen and that the
      return value will be propagated back by the clone function.
      Russell Belfer committed
    • Fix checkout notify callback docs and tests · cbd04896
      The checkout notify callback behavior on non-zero return values
      was not being tested.  This adds tests, fixes a bug with positive
      values, and clarifies the documentation to make it clear that the
      checkout can be canceled via this mechanism.
      Russell Belfer committed
    • Update git_blob_create_fromchunks callback behavr · 19853bdd
      The callback to supply data chunks could return a negative value
      to stop creation of the blob, but we were neither using GIT_EUSER
      nor propagating the return value.  This makes things use the new
      behavior of returning the negative value back to the user.
      Russell Belfer committed
    • Further callback error check style fixes · f10d7a36
      Okay, I've decided I like the readability of this style much
      better so I used it everywhere.
      Russell Belfer committed
    • Some callback error check style cleanups · c7b3e1b3
      I find this easier to read...
      Russell Belfer committed
    • Fix C99 __func__ for MSVC · 60058018
      Russell Belfer committed
    • Remove converting user error to GIT_EUSER · 25e0b157
      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 committed
    • Add git_vector_free_all · fcd324c6
      There are a lot of places that we call git__free on each item in
      a vector and then call git_vector_free on the vector itself.  This
      just wraps that up into one convenient helper function.
      Russell Belfer committed
    • Further EUSER and error propagation fixes · dab89f9b
      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 committed
    • Improve GIT_EUSER handling · 96869a4e
      This adds giterr_user_cancel to return GIT_EUSER and clear any
      error message that is sitting around.  As a result of using that
      in places, we need to be more thorough with capturing errors that
      happen inside a callback when used internally.  To help with that,
      this also adds giterr_capture and giterr_restore so that when we
      internally use a foreach-type function that clears errors and
      converts them to GIT_EUSER, it is easier to restore not just the
      return value, but the actual error message text.
      Russell Belfer committed
    • Add config read fns with controlled error behavior · 9f77b3f6
      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 committed
    • Merge pull request #1985 from libgit2/diff-rename-config · 0eedacb0
      Rename detection using diff.renames
      Russell Belfer committed
    • Check version earlier · 5a52d6be
      Ben Straub committed
  4. 09 Dec, 2013 2 commits
  5. 08 Dec, 2013 4 commits
  6. 06 Dec, 2013 5 commits
  7. 05 Dec, 2013 5 commits