diff options
| author | Vicent Martà <vicent@github.com> | 2012-08-23 14:10:47 -0700 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2012-08-23 14:10:47 -0700 |
| commit | c920e162325d0f9acba46a19c4619e6bfa17707e (patch) | |
| tree | bb1d939d73ce2c2bd9d3001c643bcf28602a8271 /src/attr_file.c | |
| parent | 5fdc41e76591aebdbae3b49440bc2c8b2430718c (diff) | |
| parent | e9ca852e4d77e1b1723a2dceddfa2037677e2fb4 (diff) | |
| download | libgit2-c920e162325d0f9acba46a19c4619e6bfa17707e.tar.gz | |
Merge pull request #844 from arrbee/init-extended
Add git_repository_init_ext for power initters
Diffstat (limited to 'src/attr_file.c')
| -rw-r--r-- | src/attr_file.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/attr_file.c b/src/attr_file.c index 20b3cf631..b2f312e3e 100644 --- a/src/attr_file.c +++ b/src/attr_file.c @@ -250,18 +250,15 @@ git_attr_assignment *git_attr_rule__lookup_assignment( int git_attr_path__init( git_attr_path *info, const char *path, const char *base) { + ssize_t root; + /* build full path as best we can */ git_buf_init(&info->full, 0); - if (base != NULL && git_path_root(path) < 0) { - if (git_buf_joinpath(&info->full, base, path) < 0) - return -1; - info->path = info->full.ptr + strlen(base); - } else { - if (git_buf_sets(&info->full, path) < 0) - return -1; - info->path = info->full.ptr; - } + if (git_path_join_unrooted(&info->full, path, base, &root) < 0) + return -1; + + info->path = info->full.ptr + root; /* remove trailing slashes */ while (info->full.size > 0) { |
