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.
Merge pull request #2269 from libgit2/rb/fix-leading-slash-ignores

Fix core.excludesfile named .gitignore
Add GIT_BRANCH_ALL to git_branch_t enum

git_branch_t is an enum so requesting GIT_BRANCH_LOCAL | GIT_BRANCH_REMOTE is not possible as it is not a member of the enum (at least VS2013 C++ complains about it).

This fixes a regression introduced in commit a667ca8298193b3103c1dbdcb1f6c527e6e99eb2 (PR #1946).

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Merge pull request #2270 from csware/fix_git_branch_t_enum

Add GIT_BRANCH_LOCAL_AND_REMOTE to git_branch_t enum