1. 06 May, 2014 1 commit
    • Improve checks for ignore containment · f554611a
      The diff code was using an "ignored_prefix" directory to track if
      a parent directory was ignored that contained untracked files
      alongside tracked files. Unfortunately, when negative ignore rules
      were used for directories inside ignored parents, the wrong rules
      were applied to untracked files inside the negatively ignored
      child directories.
      
      This commit moves the logic for ignore containment into the workdir
      iterator (which is a better place for it), so the ignored-ness of
      a directory is contained in the frame stack during traversal.  This
      allows a child directory to override with a negative ignore and yet
      still restore the ignored state of the parent when we traverse out
      of the child.
      
      Along with this, there are some problems with "directory only"
      ignore rules on container directories.  Given "a/*" and "!a/b/c/"
      (where the second rule is a directory rule but the first rule is
      just a generic prefix rule), then the directory only constraint
      was having "a/b/c/d/file" match the first rule and not the second.
      This was fixed by having ignore directory-only rules test a rule
      against the prefix of a file with LEADINGDIR enabled.
      
      Lastly, spot checks for ignores using `git_ignore_path_is_ignored`
      were tested from the top directory down to the bottom to deal with
      the containment problem, but this is wrong. We have to test bottom
      to top so that negative subdirectory rules will be checked before
      parent ignore rules.
      
      This does change the behavior of some existing tests, but it seems
      only to bring us more in line with core Git, so I think those
      changes are acceptable.
      Russell Belfer committed
  2. 18 Apr, 2014 1 commit
    • Pop ignore only if whole relative path matches · 6a0956e5
      When traversing the directory structure, the iterator pushes and
      pops ignore files using a vector.  Some directories don't have
      ignore files, so it uses a path comparison to decide when it is
      right to actually pop the last ignore file.  This was only
      comparing directory suffixes, though, so a subdirectory with the
      same name as a parent could result in the parent's .gitignore
      being popped off the list ignores too early.  This changes the
      logic to compare the entire relative path of the ignore file.
      Russell Belfer committed
  3. 10 Apr, 2014 1 commit
    • Fix bug popping ignore files during wd iteration · 8f7bc646
      There were a couple bugs in popping ignore files during iteration
      that could result in incorrect decisions be made and thus ignore
      files below the root either not being loaded correctly or not
      being popped at the right time.
      
      One bug was an off-by-one in comparing the path of the gitignore
      file with the path being exited during iteration.
      
      The second bug was not correctly truncating the path being tracked
      during traversal if there were no ignores on the list (i.e. when
      you have no .gitignore at the root, but do have some in contained
      directories).
      Russell Belfer committed
  4. 09 Aug, 2013 1 commit
    • Improve building ignore file lists · ba8b8c04
      The routines to push and pop ignore files while traversing a
      directory had some issues. In particular, setting up the initial
      list would sometimes push an ignore file before it ought to be
      applied if the starting path was a directory containing an ignore
      file. Also, the pop function was not always matching the right
      part of the path and would fail to pop ignores from the list in
      some cases.
      
      This adds some tests that exercise a particular problematic case
      and then fixes the problems that I could find related to this.
      
      At some point, I'd like to isolate this ignore rule management
      code and rewrite it, but that's a larger project and right now,
      I'll opt to just try to fix the broken behaviors.
      Russell Belfer committed
  5. 19 Jun, 2013 1 commit
    • Add fn to check pathspec for ignored files · 85b8b18b
      Command line Git sometimes generates an error message if given a
      pathspec that contains an exact match to an ignored file (provided
      --force isn't also given).  This adds an internal function that
      makes it easy to check it that has happened.  Right now, I'm not
      creating a public API for this because that would get a little
      more complicated with a need for callbacks for all invalid paths.
      Russell Belfer committed
  6. 23 Apr, 2013 1 commit
  7. 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
  8. 08 Jan, 2013 1 commit
  9. 17 Sep, 2012 1 commit
  10. 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
  11. 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
  12. 13 Feb, 2012 1 commit
  13. 31 Jan, 2012 1 commit
    • Fix attr path is_dir check · adc9bdb3
      When building an attr path object, the code that checks if the
      file is a directory was evaluating the file as a relative path
      to the current working directory, instead of using the repo root.
      This lead to inconsistent behavior.
      Russell Belfer committed
  14. 16 Jan, 2012 1 commit
    • Patch cleanup for merge · cfbc880d
      After reviewing the gitignore support with Vicent, we came up
      with a list of minor cleanups to prepare for merge, including:
      
      * checking git_repository_config error returns
      * renaming git_ignore_is_ignored and moving to status.h
      * fixing next_line skipping to include \r skips
      * commenting on where ignores are and are not included
      Russell Belfer committed
  15. 12 Jan, 2012 1 commit
  16. 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