summaryrefslogtreecommitdiff
path: root/src/attr_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/attr_file.c')
-rw-r--r--src/attr_file.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/attr_file.c b/src/attr_file.c
index 5fd136c77..74b2b6d12 100644
--- a/src/attr_file.c
+++ b/src/attr_file.c
@@ -234,7 +234,7 @@ git_attr_assignment *git_attr_rule__lookup_assignment(
}
int git_attr_path__init(
- git_attr_path *info, const char *path)
+ git_attr_path *info, const char *path, const char *base)
{
assert(info && path);
info->path = path;
@@ -243,7 +243,17 @@ int git_attr_path__init(
info->basename++;
if (!info->basename || !*info->basename)
info->basename = path;
+
+ if (base != NULL && git_path_root(path) < 0) {
+ git_buf full_path = GIT_BUF_INIT;
+ int error = git_buf_joinpath(&full_path, base, path);
+ if (error == GIT_SUCCESS)
+ info->is_dir = (git_path_isdir(full_path.ptr) == GIT_SUCCESS);
+ git_buf_free(&full_path);
+ return error;
+ }
info->is_dir = (git_path_isdir(path) == GIT_SUCCESS);
+
return GIT_SUCCESS;
}