libgit2/libgit2 — pull request #2566 by arrbee (2014-09-16 05:06:41+00:00)
Title: Fix attribute lookup in index for bare repos

When using a bare repo with an index, libgit2 attempts to read attribute files from the index. It caches those files based on the path to the file, specifically the path to the directory that contains the file.

If there is no working directory, we use `git_path_dirname_r` to get the path to the containing directory. However, for the `.gitattributes` file in the root of the repository, this ends up normalizing the containing path to `"."` instead of the empty string and the lookup the `.gitattributes` data fails.

This adds a test of attribute lookups on bare repos and also fixes the problem by simply rewriting `"."` to be `""`.

Arguably we should just replace the use of `git_path_dirname_r` instead and I could easily be convinced to do that if it seems cleaner.

/attn @vmg