1. 24 May, 2013 1 commit
    • Add ~ expansion to global attributes and excludes · 7a5ee3dc
      This adds ~/ prefix expansion for the value of core.attributesfile
      and core.excludesfile, plus it fixes the fact that the attributes
      cache was holding on to the string data from the config for a long
      time (instead of making its own strdup) which could have caused a
      problem if the config was refreshed.  Adds a test for the new
      expansion capability.
      Russell Belfer committed
  2. 15 May, 2013 1 commit
  3. 29 Apr, 2013 1 commit
  4. 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
  5. 22 Feb, 2013 1 commit
  6. 27 Jan, 2013 1 commit
  7. 04 Jan, 2013 1 commit
  8. 27 Nov, 2012 1 commit
  9. 31 Oct, 2012 2 commits
  10. 30 Oct, 2012 2 commits
    • Add git_config_refresh() API to reload config · 744cc03e
      This adds a new API that allows users to reload the config if the
      file has changed on disk.  A new config callback function to
      refresh the config was added.
      
      The modified time and file size are used to test if the file needs
      to be reloaded (and are now stored in the disk backend object).
      
      In writing tests, just using mtime was a problem / race, so I
      wanted to check file size as well.  To support that, I extended
      `git_futils_readbuffer_updated` to optionally check file size in
      addition to mtime, and I added a new function `git_filebuf_stats`
      to fetch the mtime and size for an open filebuf (so that the
      config could be easily refreshed after a write).
      
      Lastly, I moved some similar file checking code for attributes
      into filebuf.  It is still only being used for attrs, but it
      seems potentially reusable, so I thought I'd move it over.
      Russell Belfer committed
    • index refactoring · f45ec1a0
      Edward Thomson committed
  11. 17 Sep, 2012 1 commit
  12. 05 Sep, 2012 1 commit
    • Diff iterators · f335ecd6
      This refactors the diff output code so that an iterator object
      can be used to traverse and generate the diffs, instead of just
      the `foreach()` style with callbacks.  The code has been rearranged
      so that the two styles can still share most functions.
      
      This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses
      that as a common error code for marking the end of iteration when
      using a iterator style of object.
      Russell Belfer committed
  13. 24 Aug, 2012 1 commit
  14. 22 Aug, 2012 1 commit
  15. 09 Aug, 2012 1 commit
  16. 04 Aug, 2012 1 commit
    • Update iterators for consistency across library · 5dca2010
      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.
      Russell Belfer committed
  17. 01 Aug, 2012 1 commit
    • attr: Do not export variables externally · 0c9eacf3
      Fixes #824
      
      Exporting variables in a dynamic library is a PITA. Let's keep
      these values internally and wrap them through a helper method.
      
      This doesn't break the external API. @arrbee, aren't you glad I turned
      the `GIT_ATTR_` macros into function macros? :sparkles:
      Vicent Marti committed
  18. 24 Jul, 2012 1 commit
  19. 07 Jun, 2012 1 commit
  20. 25 May, 2012 1 commit
    • Fix bugs for status with spaces and reloaded attrs · 2a99df69
      This fixes two bugs:
      
      * Issue #728 where git_status_file was not working for files
        that contain spaces.  This was caused by reusing the "fnmatch"
        parsing code from ignore and attribute files to interpret the
        "pathspec" that constrained the files to apply the status to.
        In that code, unescaped whitespace was considered terminal to
        the pattern, so a file with internal whitespace was excluded
        from the matched files.  The fix was to add a mode to that code
        that allows spaces and tabs inside patterns.  This mode only
        comes into play when parsing in-memory strings.
      
      * The other issue was undetected, but it was in the recently
        added code to reload gitattributes / gitignores when they were
        changed on disk.  That code was not clearing out the old values
        from the cached file content before reparsing which meant that
        newly added patterns would be read in, but deleted patterns
        would not be removed.  The fix was to clear the vector of
        patterns in a cached file before reparsing the file.
      Russell Belfer committed
  21. 17 May, 2012 3 commits
  22. 10 May, 2012 1 commit
    • Add cache busting to attribute cache · dc13f1f7
      This makes the git attributes and git ignores cache check
      stat information before using the file contents from the
      cache.  For cached files from the index, it checks the SHA
      of the file instead.  This should reduce the need to ever
      call `git_attr_cache_flush()` in most situations.
      
      This commit also fixes the `git_status_should_ignore` API
      to use the libgit2 standard parameter ordering.
      Russell Belfer committed
  23. 07 May, 2012 1 commit
  24. 04 May, 2012 1 commit
  25. 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
  26. 26 Apr, 2012 1 commit
  27. 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
  28. 11 Apr, 2012 1 commit
    • Refactor git_repository_open with new options · 7784bcbb
      Add a new command `git_repository_open_ext` with extended options
      that control how searching for a repository will be done.  The
      existing `git_repository_open` and `git_repository_discover` are
      reimplemented on top of it.  We may want to change the default
      behavior of `git_repository_open` but this commit does not do that.
      
      Improve support for "gitdir" files where the work dir is separate
      from the repo and support for the "separate-git-dir" config.  Also,
      add support for opening repos created with `git-new-workdir` script
      (although I have only confirmed that they can be opened, not that
      all functions work correctly).
      
      There are also a few minor changes that came up:
      
      - Fix `git_path_prettify` to allow in-place prettifying.
      
      - Fix `git_path_root` to support backslashes on Win32.  This fix
        should help many repo open/discover scenarios - it is the one
        function called when opening before prettifying the path.
      
      - Tweak `git_config_get_string` to set the "out" pointer to NULL
        if the config value is not found.  Allows some other cleanup.
      
      - Fix a couple places that should have been calling
        `git_repository_config__weakptr` and were not.
      
      - Fix `cl_git_sandbox_init` clar helper to support bare repos.
      Russell Belfer committed
  29. 30 Mar, 2012 1 commit
  30. 16 Mar, 2012 1 commit
  31. 14 Mar, 2012 1 commit
    • Convert attr and other files to new errors · ab43ad2f
      This continues to add other files to the new error handling
      style.  I think the only real concerns here are that there are
      a couple of error return cases that I have converted to asserts,
      but I think that it was the correct thing to do given the new
      error style.
      Russell Belfer committed
  32. 06 Mar, 2012 1 commit
  33. 02 Mar, 2012 1 commit
    • Clean up GIT_UNUSED macros on all platforms · 854eccbb
      It turns out that commit 31e9cfc4cbcaf1b38cdd3dbe3282a8f57e5366a5
      did not fix the GIT_USUSED behavior on all platforms.  This commit
      walks through and really cleans things up more thoroughly, getting
      rid of the unnecessary stuff.
      
      To remove the use of some GIT_UNUSED, I ended up adding a couple
      of new iterators for hashtables that allow you to iterator just
      over keys or just over values.
      
      In making this change, I found a bug in the clar tests (where we
      were doing *count++ but meant to do (*count)++ to increment the
      value).  I fixed that but then found the test failing because it
      was not really using an empty repo.  So, I took some of the code
      that I wrote for iterator testing and moved it to clar_helpers.c,
      then made use of that to make it easier to open fixtures on a
      per test basis even within a single test file.
      Russell Belfer committed
  34. 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