1. 29 Apr, 2015 1 commit
  2. 10 Apr, 2015 1 commit
    • Fix checking of return value for regcomp. · 129022ee
      The regcomp function returns a non-zero value if compilation of
      a regular expression fails. In most places we only check for
      negative values, but positive values indicate an error, as well.
      Fix this tree-wide, fixing a segmentation fault when calling
      git_config_iterator_glob_new with an invalid regexp.
      Patrick Steinhardt committed
  3. 03 Mar, 2015 1 commit
    • config: borrow refcounted references · 9a97f49e
      This changes the get_entry() method to return a refcounted version of
      the config entry, which you have to free when you're done.
      
      This allows us to avoid freeing the memory in which the entry is stored
      on a refresh, which may happen at any time for a live config.
      
      For this reason, get_string() has been forbidden on live configs and a
      new function get_string_buf() has been added, which stores the string in
      a git_buf which the user then owns.
      
      The functions which parse the string value takea advantage of the
      borrowing to parse safely and then release the entry.
      Carlos Martín Nieto committed
  4. 14 Jan, 2015 1 commit
  5. 23 Oct, 2014 1 commit
  6. 30 May, 2014 1 commit
  7. 13 May, 2014 1 commit
  8. 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
  9. 02 May, 2014 2 commits
    • Improve handling of fake home directory · 0f603132
      There are a few tests that set up a fake home directory and a
      fake GLOBAL search path so that we can test things in global
      ignore or attribute or config files.  This cleans up that code to
      work more robustly even if there is a test failure.  This also
      fixes some valgrind warnings where scanning search paths for
      separators could end up doing a little bit of sketchy data access
      when coming to the end of search list.
      Russell Belfer committed
    • Fix remaining init_options inconsistencies · bc91347b
      There were a couple of "init_opts()" functions a few more cases
      of structure initialization that I somehow missed.
      Russell Belfer committed
  10. 30 Apr, 2014 1 commit
  11. 18 Apr, 2014 1 commit
    • config: implement config snapshotting · 55ebd7d3
      In order to have consistent views of the config files for remotes,
      submodules et al. and a configuration that represents what is currently
      stored on-disk, we need a way to provide a view of the configuration
      that does not change.
      
      The goal here is to provide the snapshotting part by creating a
      read-only copy of the state of the configuration at a particular point
      in time, which does not change when a repository's main config changes.
      Carlos Martín Nieto committed
  12. 01 Apr, 2014 1 commit
    • Fix git_submodule_sync and add new config helper · 8286300a
      This fixes `git_submodule_sync` to correctly update the remote URL
      of the default branch of the submodule along with the URL in the
      parent repository config (i.e. match core Git's behavior).
      
      Also move some useful helper logic from the submodule code into
      a shared config API `git_config__update_entry` that can either set
      or delete an entry with constraints like not overwriting or not
      creating a new entry.  I used that helper to update a couple other
      places in the code.
      Russell Belfer committed
  13. 06 Mar, 2014 1 commit
  14. 25 Feb, 2014 1 commit
  15. 27 Jan, 2014 1 commit
  16. 18 Jan, 2014 1 commit
  17. 13 Jan, 2014 2 commits
  18. 11 Dec, 2013 5 commits
    • 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
    • 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
    • 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
  19. 31 Oct, 2013 1 commit
    • Fix saving remotes with several fetch/push ref specs. · 3793fa9b
      At some moment git_config_delete_entry lost the ability to delete one entry of
      a multivar configuration. The moment you had more than one fetch or push
      ref spec for a remote you will not be able to save that remote anymore. The
      changes in network::remote::remotes::save show that problem.
      
      I needed to create a new git_config_delete_multivar because I was not able to
      remove one or several entries of a multivar config with the current API.
      Several tries modifying how git_config_set_multivar(..., NULL) behaved were
      not successful.
      
      git_config_delete_multivar is very similar to git_config_set_multivar, and
      delegates into config_delete_multivar of config_file. This function search
      for the cvar_t that will be deleted, storing them in a temporal array, and
      rebuilding the linked list. After calling config_write to delete the entries,
      the cvar_t stored in the temporal array are freed.
      
      There is a little fix in config_write, it avoids an infinite loop when using
      a regular expression (case for the multivars). This error was found by the
      test network::remote::remotes::tagopt.
      Daniel Rodríguez Troitiño committed
  20. 13 Aug, 2013 1 commit
  21. 12 Aug, 2013 5 commits
  22. 08 Aug, 2013 9 commits