summaryrefslogtreecommitdiff
path: root/tests-clar/object/tree/write.c
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2012-08-21 14:32:09 -0700
committerVicent Martí <vicent@github.com>2012-08-21 14:32:09 -0700
commit697665c0c13e45a5d24af85c133ffaa0a0e0f8cc (patch)
tree9e32cfadd2e1ffaa05f72dd5871551180ee0afb9 /tests-clar/object/tree/write.c
parentb2be351aaddc6ba0b3a0f2cf4e09536a3b27e598 (diff)
parent9d7ac675d06dab2e000ad32f9248631af0191f85 (diff)
downloadlibgit2-697665c0c13e45a5d24af85c133ffaa0a0e0f8cc.tar.gz
Merge pull request #889 from nulltoken/filemode-enum
Filemode enum
Diffstat (limited to 'tests-clar/object/tree/write.c')
-rw-r--r--tests-clar/object/tree/write.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/tests-clar/object/tree/write.c b/tests-clar/object/tree/write.c
index 8b0f3417f..657bed289 100644
--- a/tests-clar/object/tree/write.c
+++ b/tests-clar/object/tree/write.c
@@ -35,11 +35,16 @@ void test_object_tree_write__from_memory(void)
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
cl_git_pass(git_treebuilder_create(&builder, tree));
- cl_git_fail(git_treebuilder_insert(NULL, builder, "", &bid, 0100644));
- cl_git_fail(git_treebuilder_insert(NULL, builder, "/", &bid, 0100644));
- cl_git_fail(git_treebuilder_insert(NULL, builder, "folder/new.txt", &bid, 0100644));
+ cl_git_fail(git_treebuilder_insert(NULL, builder, "",
+ &bid, GIT_FILEMODE_BLOB));
+ cl_git_fail(git_treebuilder_insert(NULL, builder, "/",
+ &bid, GIT_FILEMODE_BLOB));
+ cl_git_fail(git_treebuilder_insert(NULL, builder, "folder/new.txt",
+ &bid, GIT_FILEMODE_BLOB));
+
+ cl_git_pass(git_treebuilder_insert(
+ NULL, builder, "new.txt", &bid, GIT_FILEMODE_BLOB));
- cl_git_pass(git_treebuilder_insert(NULL,builder,"new.txt",&bid,0100644));
cl_git_pass(git_treebuilder_write(&rid, g_repo, builder));
cl_assert(git_oid_cmp(&rid, &id2) == 0);
@@ -63,14 +68,16 @@ void test_object_tree_write__subtree(void)
//create subtree
cl_git_pass(git_treebuilder_create(&builder, NULL));
- cl_git_pass(git_treebuilder_insert(NULL,builder,"new.txt",&bid,0100644)); //-V536
+ cl_git_pass(git_treebuilder_insert(
+ NULL, builder, "new.txt", &bid, GIT_FILEMODE_BLOB)); //-V536
cl_git_pass(git_treebuilder_write(&subtree_id, g_repo, builder));
git_treebuilder_free(builder);
// create parent tree
cl_git_pass(git_tree_lookup(&tree, g_repo, &id));
cl_git_pass(git_treebuilder_create(&builder, tree));
- cl_git_pass(git_treebuilder_insert(NULL,builder,"new",&subtree_id,040000)); //-V536
+ cl_git_pass(git_treebuilder_insert(
+ NULL, builder, "new", &subtree_id, GIT_FILEMODE_TREE)); //-V536
cl_git_pass(git_treebuilder_write(&id_hiearar, g_repo, builder));
git_treebuilder_free(builder);
git_tree_free(tree);
@@ -96,23 +103,23 @@ void test_object_tree_write__sorted_subtrees(void)
unsigned int attr;
const char *filename;
} entries[] = {
- { 0100644, ".gitattributes" },
- { 0100644, ".gitignore" },
- { 0100644, ".htaccess" },
- { 0100644, "Capfile" },
- { 0100644, "Makefile"},
- { 0100644, "README"},
- { 0040000, "app"},
- { 0040000, "cake"},
- { 0040000, "config"},
- { 0100644, "c"},
- { 0100644, "git_test.txt"},
- { 0100644, "htaccess.htaccess"},
- { 0100644, "index.php"},
- { 0040000, "plugins"},
- { 0040000, "schemas"},
- { 0040000, "ssl-certs"},
- { 0040000, "vendors"}
+ { GIT_FILEMODE_BLOB, ".gitattributes" },
+ { GIT_FILEMODE_BLOB, ".gitignore" },
+ { GIT_FILEMODE_BLOB, ".htaccess" },
+ { GIT_FILEMODE_BLOB, "Capfile" },
+ { GIT_FILEMODE_BLOB, "Makefile"},
+ { GIT_FILEMODE_BLOB, "README"},
+ { GIT_FILEMODE_TREE, "app"},
+ { GIT_FILEMODE_TREE, "cake"},
+ { GIT_FILEMODE_TREE, "config"},
+ { GIT_FILEMODE_BLOB, "c"},
+ { GIT_FILEMODE_BLOB, "git_test.txt"},
+ { GIT_FILEMODE_BLOB, "htaccess.htaccess"},
+ { GIT_FILEMODE_BLOB, "index.php"},
+ { GIT_FILEMODE_TREE, "plugins"},
+ { GIT_FILEMODE_TREE, "schemas"},
+ { GIT_FILEMODE_TREE, "ssl-certs"},
+ { GIT_FILEMODE_TREE, "vendors"}
};
git_oid blank_oid, tree_oid;