]> git.proxmox.com Git - libgit2.git/commit - src/repository.c
Fix attribute lookup in index for bare repos
authorRussell Belfer <rb@github.com>
Tue, 16 Sep 2014 04:59:23 +0000 (21:59 -0700)
committerRussell Belfer <rb@github.com>
Tue, 16 Sep 2014 04:59:23 +0000 (21:59 -0700)
commit1fbeb2f04c9a81a0fcacee5042d9e12a1e90052b
treee988bdf1b2a488efd9310b1d50abc2b512f3df80
parent910cd2daa6af0f3af97d283eb4c6a0452688d067
Fix attribute lookup in index for bare repos

When using a bare repo with an index, libgit2 attempts to read
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 `""`.
include/git2/sys/repository.h
src/attr.c
src/repository.c
tests/attr/repo.c