• Show log

    Commit

  • Hash : bd4ca902
    Author : Russell Belfer
    Date : 2012-05-16T17:02:06

    Fix status for files under ignored dirs
    
    There was a bug where tracked files inside directories that were
    inside ignored directories where not being found by status.  To
    make that a little clearer, if you have a .gitignore with:
    
        ignore/
    
    And then have the following files:
    
        ignore/dir/tracked     <-- actually a tracked file
        ignore/dir/untracked   <-- should be ignored
    
    Then we would show the tracked file as being removed (because
    when we got the to contained item "dir/" inside the ignored
    directory, we decided it was safe to skip -- bzzt, wrong!).
    
    This update is much more careful about checking that we are
    not skipping over any prefix of a tracked item, regardless of
    whether it is ignored or not.
    
    As documented in diff.c, this commit does create behavior that
    still differs from core git with regards to the handling of
    untracked files contained inside ignored directories.  With
    libgit2, those files will just not show up in status or diff.
    With core git, those files don't show up in status or diff
    either *unless* they are explicitly ignored by a .gitignore
    pattern in which case they show up as ignored files.
    
    Needless to say, this is a local behavior difference only, so
    it should not be important and (to me) the libgit2 behavior
    seems more consistent.