summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-04-15 09:07:57 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2013-10-08 10:07:31 +0200
commit13f670a5d9d86629f4879f6df9494356e4f28832 (patch)
tree2a09d4df939f555c5c43a1f26c944dc02c8e0219 /src/tree.c
parent711333efe1c1388c39cd76480273b4fcea18d491 (diff)
downloadlibgit2-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.c9
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);