1. 20 Jun, 2016 1 commit
  2. 24 May, 2016 1 commit
  3. 19 May, 2016 2 commits
  4. 17 May, 2016 1 commit
    • Introduce a function to create a tree based on a different one · 9464f9eb
      Instead of going through the usual steps of reading a tree recursively
      into an index, modifying it and writing it back out as a tree, introduce
      a function to perform simple updates more efficiently.
      
      `git_tree_create_updated` avoids reading trees which are not modified
      and supports upsert and delete operations. It is not as versatile as
      modifying the index, but it makes some common operations much more
      efficient.
      Carlos Martín Nieto committed
  5. 25 Apr, 2016 1 commit
  6. 22 Mar, 2016 3 commits
    • blob: remove _fromchunks() · 6669e3e8
      The callback mechanism makes it awkward to write data from an IO
      source; move to `_fromstream()` which lets the caller remain in control,
      in the same vein as we prefer iterators over foreach callbacks.
      Carlos Martín Nieto committed
    • blob: fix fromchunks iteration counter · 35e68606
      By returning when the count goes to zero rather than below it, setting
      `howmany` to 7 in fact writes out the string 6 times.
      
      Correct the termination condition to write out the string the amount of
      times we specify.
      Carlos Martín Nieto committed
    • blob: introduce creating a blob by writing into a stream · 0a5c6028
      The pair of `git_blob_create_frombuffer()` and
      `git_blob_create_frombuffer_commit()` is meant to replace
      `git_blob_create_fromchunks()` by providing a way for a user to write a
      new blob when they want filtering or they do not know the size.
      
      This approach allows the caller to retain control over when to add data
      to this buffer and a more natural fit into higher-level language's own
      stream abstractions instead of having to handle IO wait in the callback.
      
      The in-memory buffer size of 2MB is chosen somewhat arbitrarily to be a
      round multiple of usual page sizes and a value where most blobs seem
      likely to be either going to be way below or way over that size. It's
      also a round number of pages.
      
      This implementation re-uses the helper we have from `_fromchunks()` so
      we end up writing everything to disk, but hopefully more efficiently
      than with a default filebuf. A later optimisation can be to avoid
      writing the in-memory contents to disk, with some extra complexity.
      Carlos Martín Nieto committed
  7. 20 Mar, 2016 1 commit
  8. 04 Mar, 2016 1 commit
  9. 28 Feb, 2016 3 commits
  10. 28 May, 2015 1 commit
  11. 04 Jan, 2015 1 commit
  12. 27 Dec, 2014 1 commit
  13. 17 Dec, 2014 1 commit
  14. 22 Nov, 2014 1 commit
    • peel: reject bad queries with EINVALIDSPEC · 753e17b0
      There are some combination of objects and target types which we know
      cannot be fulfilled. Return EINVALIDSPEC for those to signify that there
      is a mismatch in the user-provided data and what the object model is
      capable of satisfying.
      
      If we start at a tag and in the course of peeling find out that we
      cannot reach a particular type, we return EPEEL.
      Carlos Martín Nieto committed
  15. 16 Sep, 2014 1 commit
  16. 18 Aug, 2014 1 commit
  17. 01 Jul, 2014 1 commit
  18. 10 Jun, 2014 1 commit
    • treebuilder: use a map instead of vector to store the entries · 4d3f1f97
      Finding a filename in a vector means we need to resort it every time we
      want to read from it, which includes every time we want to write to it
      as well, as we want to find duplicate keys.
      
      A hash-map fits what we want to do much more accurately, as we do not
      care about sorting, but just the particular filename.
      
      We still keep removed entries around, as the interface let you assume
      they were going to be around until the treebuilder is cleared or freed,
      but in this case that involves an append to a vector in the filter case,
      which can now fail.
      
      The only time we care about sorting is when we write out the tree, so
      let's make that the only time we do any sorting.
      Carlos Martín Nieto committed
  19. 07 Jun, 2014 1 commit
  20. 18 May, 2014 1 commit
  21. 08 May, 2014 1 commit
    • Be more careful with user-supplied buffers · 1e4976cb
      This adds in missing calls to `git_buf_sanitize` and fixes a
      number of places where `git_buf` APIs could inadvertently write
      NUL terminator bytes into invalid buffers.  This also changes the
      behavior of `git_buf_sanitize` to NUL terminate a buffer if it can
      and of `git_buf_shorten` to do nothing if it can.
      
      Adds tests of filtering code with zeroed (i.e. unsanitized) buffer
      which was previously triggering a segfault.
      Russell Belfer committed
  22. 06 May, 2014 1 commit
    • Add filter options and ALLOW_UNSAFE · 5269008c
      Diff and status do not want core.safecrlf to actually raise an
      error regardless of the setting, so this extends the filter API
      with an additional options flags parameter and adds a flag so that
      filters can be applied with GIT_FILTER_OPT_ALLOW_UNSAFE, indicating
      that unsafe filter application should be downgraded from a failure
      to a warning.
      Russell Belfer committed
  23. 29 Apr, 2014 1 commit
    • commit: safer commit creation with reference update · 217c029b
      The current version of the commit creation and amend function are unsafe
      to use when passing the update_ref parameter, as they do not check that
      the reference at the moment of update points to what the user expects.
      
      Make sure that we're moving history forward when we ask the library to
      update the reference for us by checking that the first parent of the new
      commit is the current value of the reference. We also make sure that the
      ref we're updating hasn't moved between the read and the write.
      
      Similarly, when amending a commit, make sure that the current tip of the
      branch is the commit we're amending.
      Carlos Martín Nieto committed
  24. 10 Mar, 2014 1 commit
  25. 05 Mar, 2014 1 commit
  26. 08 Feb, 2014 1 commit
    • Add git_commit_amend API · 80c29fe9
      This adds an API to amend an existing commit, basically a shorthand
      for creating a new commit filling in missing parameters from the
      values of an existing commit.  As part of this, I also added a new
      "sys" API to create a commit using a callback to get the parents.
      This allowed me to rewrite all the other commit creation APIs so
      that temporary allocations are no longer needed.
      Russell Belfer committed
  27. 27 Jan, 2014 1 commit
  28. 25 Jan, 2014 1 commit
  29. 03 Jan, 2014 2 commits
  30. 12 Dec, 2013 1 commit
  31. 11 Dec, 2013 2 commits
    • 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
    • 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
  32. 14 Nov, 2013 1 commit