diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-04-15 09:07:57 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-10-08 10:07:31 +0200 |
commit | 13f670a5d9d86629f4879f6df9494356e4f28832 (patch) | |
tree | 2a09d4df939f555c5c43a1f26c944dc02c8e0219 /src/tree.c | |
parent | 711333efe1c1388c39cd76480273b4fcea18d491 (diff) | |
download | libgit2-13f670a5d9d86629f4879f6df9494356e4f28832.tar.gz |
tree: allow retrieval of raw attributes
When a tool needs to recreate the tree object (for example an
interface to another VCS), it needs to use the raw attributes,
forgoing any normalization.
Diffstat (limited to 'src/tree.c')
-rw-r--r-- | src/tree.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tree.c b/src/tree.c index 0bdf9a93e..bb59ff82b 100644 --- a/src/tree.c +++ b/src/tree.c @@ -237,7 +237,12 @@ void git_tree__free(void *_tree) git_filemode_t git_tree_entry_filemode(const git_tree_entry *entry) { - return (git_filemode_t)entry->attr; + return normalize_filemode(entry->attr); +} + +git_filemode_t git_tree_entry_filemode_raw(const git_tree_entry *entry) +{ + return entry->attr; } const char *git_tree_entry_name(const git_tree_entry *entry) @@ -386,8 +391,6 @@ int git_tree__parse(void *_tree, git_odb_object *odb_obj) if (git__strtol32(&attr, buffer, &buffer, 8) < 0 || !buffer) return tree_error("Failed to parse tree. Can't parse filemode", NULL); - attr = normalize_filemode(attr); /* make sure to normalize the filemode */ - if (*buffer++ != ' ') return tree_error("Failed to parse tree. Object is corrupted", NULL); |