]> git.proxmox.com Git - libgit2.git/commit - tests/attr/ignore.c
Fix core.excludesfile named .gitignore
authorRussell Belfer <rb@github.com>
Mon, 14 Apr 2014 22:59:48 +0000 (15:59 -0700)
committerRussell Belfer <rb@github.com>
Mon, 14 Apr 2014 22:59:48 +0000 (15:59 -0700)
commita9528b8fdd627e11b9dee099a10fa7697380b3e7
treee7a54e8f5694d6cb37223e480bdab7e5bb104a65
parent289e31cd24f80fa8ed77e40eeb9295964256cb6a
Fix core.excludesfile named .gitignore

Ignore rules with slashes in them are matched using FNM_PATHNAME
and use the path to the .gitignore file from the root of the
repository along with the path fragment (including slashes) in
the ignore file itself.  Unfortunately, the relative path to the
.gitignore file was being applied to the global core.excludesfile
if that was also named ".gitignore".

This fixes that with more precise matching and includes test for
ignore rules with leading slashes (which were the primary example
of this being broken in the real world).

This also backports an improvement to the file context logic from
the threadsafe-iterators branch where we don't rely on mutating
the key of the attribute file name to generate the context path.
src/attr_file.c
src/ignore.c
tests/attr/ignore.c
tests/clar_libgit2.c
tests/clar_libgit2.h
tests/status/ignore.c