1. 22 Jan, 2019 1 commit
  2. 23 Feb, 2016 2 commits
    • common: introduce GITERR_CHECK_ALLOC_BUF · 859ed5dd
      We commonly have to check if a git_buf has been allocated
      correctly or if we ran out of memory. Introduce a new macro
      similar to `GITERR_CHECK_ALLOC` which checks if we ran OOM and if
      so returns an error. Provide a `#nodef` for Coverity to mark the
      error case as an abort path.
      Patrick Steinhardt committed
    • coverity: hint git_vector_foreach does not deref NULL contents · f2a554b4
      Coverity does not comprehend the connection between a vector's
      size and the contents pointer, that is that the vector's pointer
      is non-NULL when its size is positive. As the vector code should
      be reasonably well tested and users are expected to not manually
      modify a vector's contents it seems save to assume that the
      macros will never dereference a NULL pointer.
      
      Fix Coverity warnings by overriding the foreach macros with
      macros that explicitly aborting when (v)->contents is NULL.
      Patrick Steinhardt committed
  3. 18 Feb, 2016 2 commits
    • coverity: hint that string length is at least 2 · 40f6f225
      When checking if a string is prefixed by a drive letter (e.g.
      "C:") we verify this by inspecting the first and second character
      of the string. Coverity thinks this is a defect as we do not
      check the string's length first, but in fact we only check the
      second character if the first character is part of the alphabet,
      that is it cannot be '\0'.
      
      Fix this by overriding the macro and explicitly checking the
      string's length.
      Patrick Steinhardt committed
    • coverity: add nodefs for abort macros · 5981ab1d
      Add nodefs for macros that abort the current flow due to errors.
      This includes macros that trigger on integer overflows and for
      the version check macro. This aids Coverity as we point out that
      these paths will cause a fatal error.
      Patrick Steinhardt committed
  4. 10 Feb, 2016 1 commit
    • coverity: provide nodef for GITERR_CHECK_ALLOC · 8dddea42
      Coverity currently lists a lot of errors with regard to
      GITERR_CHECK_ALLOC causing resource leaks. We know this macro is
      only invoked when we want to abort because we are out of memory.
      
      Coverity allows for overriding the default model where we know
      that certain functions guarantee a desired behavior. The
      user_nodefs.h is used to override the behavior of macros.
      Re-define GITERR_CHECK_ALLOC inside of it to specify its abort
      nature.
      Patrick Steinhardt committed
  5. 17 Apr, 2014 1 commit
    • Attribute file cache refactor · 7d490872
      This is a big refactoring of the attribute file cache to be a bit
      simpler which in turn makes it easier to enforce a lock around any
      updates to the cache so that it can be used in a threaded env.
      Tons of changes to the attributes and ignores code.
      Russell Belfer committed
  6. 15 Mar, 2013 1 commit
    • Implement global/system file search paths · 5540d947
      The goal of this work is to expose the search logic for "global",
      "system", and "xdg" files through the git_libgit2_opts() interface.
      
      Behind the scenes, I changed the logic for finding files to have a
      notion of a git_strarray that represents a search path and to store
      a separate search path for each of the three tiers of config file.
      For each tier, I implemented a function to initialize it to default
      values (generally based on environment variables), and then general
      interfaces to get it, set it, reset it, and prepend new directories
      to it.
      
      Next, I exposed these interfaces through the git_libgit2_opts
      interface, reusing the GIT_CONFIG_LEVEL_SYSTEM, etc., constants
      for the user to control which search path they were modifying.
      There are alternative designs for the opts interface / argument
      ordering, so I'm putting this phase out for discussion.
      
      Additionally, I ended up doing a little bit of clean up regarding
      attr.h and attr_file.h, adding a new attrcache.h so the other two
      files wouldn't have to be included in so many places.
      Russell Belfer committed
  7. 08 Jan, 2013 1 commit
  8. 17 Sep, 2012 1 commit
  9. 24 Aug, 2012 1 commit
  10. 22 Aug, 2012 1 commit
  11. 03 May, 2012 1 commit
    • Support reading attributes from index · f917481e
      Depending on the operation, we need to consider gitattributes
      in both the work dir and the index.  This adds a parameter to
      all of the gitattributes related functions that allows user
      control of attribute reading behavior (i.e. prefer workdir,
      prefer index, only use index).
      
      This fix also covers allowing us to check attributes (and
      hence do diff and status) on bare repositories.
      
      This was a somewhat larger change that I hoped because it had
      to change the cache key used for gitattributes files.
      Russell Belfer committed
  12. 25 Apr, 2012 3 commits
    • Rename git_khash_str to git_strmap, etc. · c2b67043
      This renamed `git_khash_str` to `git_strmap`, `git_hash_oid` to
      `git_oidmap`, and deletes `git_hashtable` from the tree, plus
      adds unit tests for `git_strmap`.
      Russell Belfer committed
    • Convert hashtable usage over to khash · 01fed0a8
      This updates khash.h with some extra features (like error checking
      on allocations, ability to use wrapped malloc, foreach calls, etc),
      creates two high-level wrappers around khash: `git_khash_str` and
      `git_khash_oid` for string-to-void-ptr and oid-to-void-ptr tables,
      then converts all of the old usage of `git_hashtable` over to use
      these new hashtables.
      
      For `git_khash_str`, I've tried to create a set of macros that
      yield an API not too unlike the old `git_hashtable` API.  Since
      the oid hashtable is only used in one file, I haven't bother to
      set up all those macros and just use the khash APIs directly for
      now.
      Russell Belfer committed
    • Convert attrs and diffs to use string pools · 19fa2bc1
      This converts the git attr related code (including ignores) and
      the git diff related code (and implicitly the status code) to use
      `git_pools` for storing strings.  This reduces the number of small
      blocks allocated dramatically.
      Russell Belfer committed
  13. 30 Mar, 2012 1 commit
  14. 16 Mar, 2012 1 commit
  15. 21 Feb, 2012 1 commit
    • Uniform iterators for trees, index, and workdir · b6c93aef
      This create a new git_iterator type of object that provides a
      uniform interface for iterating over the index, an arbitrary
      tree, or the working directory of a repository.
      
      As part of this, git ignore support was extended to support
      push and pop of directory-based ignore files as the working
      directory is being traversed (so the array of ignores does
      not have to be recreated at each directory during traveral).
      
      There are a number of other small utility functions in buffer,
      path, vector, and fileops that are included in this patch
      that made the iterator implementation cleaner.
      Russell Belfer committed
  16. 13 Feb, 2012 1 commit
  17. 01 Feb, 2012 1 commit
  18. 17 Jan, 2012 1 commit
    • Fix handling of relative paths for attrs · a51cd8e6
      Per issue #533, the handling of relative paths in attribute
      and ignore files was not right.  Fixed this by pre-joining
      the relative path of the attribute/ignore file onto the match
      string when a full path match is required.
      
      Unfortunately, fixing this required a bit more code than I
      would have liked because I had to juggle things around so that
      the fnmatch parser would have sufficient information to prepend
      the relative path when it was needed.
      Russell Belfer committed
  19. 11 Jan, 2012 1 commit
    • Initial implementation of gitignore support · df743c7d
      Adds support for .gitignore files to git_status_foreach() and
      git_status_file().  This includes refactoring the gitattributes
      code to share logic where possible.  The GIT_STATUS_IGNORED flag
      will now be passed in for files that are ignored (provided they
      are not already in the index or the head of repo).
      Russell Belfer committed
  20. 29 Dec, 2011 1 commit
    • Add support for macros and cache flush API. · 73b51450
      Add support for git attribute macro definitions.  Also, add
      support for cache flush API to clear the attribute file content
      cache when needed.
      
      Additionally, improved the handling of global and system files,
      making common utility functions in fileops and converting config
      and attr to both use the common functions.
      
      Adds a bunch more tests and fixed some memory leaks.  Note that
      adding macros required me to use refcounted attribute assignment
      definitions, which complicated, but probably improved memory usage.
      Russell Belfer committed
  21. 21 Dec, 2011 1 commit
    • Add APIs for git attributes · ee1f0b1a
      This adds APIs for querying git attributes.  In addition to
      the new API in include/git2/attr.h, most of the action is in
      src/attr_file.[hc] which contains utilities for dealing with
      a single attributes file, and src/attr.[hc] which contains
      the implementation of the APIs that merge all applicable
      attributes files.
      Russell Belfer committed