summaryrefslogtreecommitdiff
path: root/src/attr.c
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-01-31 13:59:32 -0800
committerRussell Belfer <arrbee@arrbee.com>2012-01-31 13:59:32 -0800
commitadc9bdb3b1428b8edf067ab17c26ef15ec1ac8a7 (patch)
tree779de1400c8c3385ab21fde0bac47b96081c50aa /src/attr.c
parent5d3cd4e309517a8ab2b553ad0839493ba45bb97d (diff)
downloadlibgit2-adc9bdb3b1428b8edf067ab17c26ef15ec1ac8a7.tar.gz
Fix attr path is_dir check
When building an attr path object, the code that checks if the file is a directory was evaluating the file as a relative path to the current working directory, instead of using the repo root. This lead to inconsistent behavior.
Diffstat (limited to 'src/attr.c')
-rw-r--r--src/attr.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/attr.c b/src/attr.c
index da0f72371..3fc01e8c9 100644
--- a/src/attr.c
+++ b/src/attr.c
@@ -21,7 +21,8 @@ int git_attr_get(
*value = NULL;
- if ((error = git_attr_path__init(&path, pathname)) < GIT_SUCCESS ||
+ if ((error = git_attr_path__init(
+ &path, pathname, git_repository_workdir(repo))) < GIT_SUCCESS ||
(error = collect_attr_files(repo, pathname, &files)) < GIT_SUCCESS)
return git__rethrow(error, "Could not get attribute for %s", pathname);
@@ -69,7 +70,8 @@ int git_attr_get_many(
memset((void *)values, 0, sizeof(const char *) * num_attr);
- if ((error = git_attr_path__init(&path, pathname)) < GIT_SUCCESS ||
+ if ((error = git_attr_path__init(
+ &path, pathname, git_repository_workdir(repo))) < GIT_SUCCESS ||
(error = collect_attr_files(repo, pathname, &files)) < GIT_SUCCESS)
return git__rethrow(error, "Could not get attributes for %s", pathname);
@@ -130,7 +132,8 @@ int git_attr_foreach(
git_attr_assignment *assign;
git_hashtable *seen = NULL;
- if ((error = git_attr_path__init(&path, pathname)) < GIT_SUCCESS ||
+ if ((error = git_attr_path__init(
+ &path, pathname, git_repository_workdir(repo))) < GIT_SUCCESS ||
(error = collect_attr_files(repo, pathname, &files)) < GIT_SUCCESS)
return git__rethrow(error, "Could not get attributes for %s", pathname);