Code

t6035-merge-dir-to-symlink depends on SYMLINKS prerequisite
[git.git] / builtin-write-tree.c
index 9d640508dd8eb62201b286490b7f83486470d611..3a24ce8157be7c4209d831027693653b8d65ca13 100644 (file)
@@ -13,7 +13,7 @@ static const char write_tree_usage[] =
 
 int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
 {
-       int missing_ok = 0, ret;
+       int flags = 0, ret;
        const char *prefix = NULL;
        unsigned char sha1[20];
        const char *me = "git-write-tree";
@@ -22,9 +22,15 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
        while (1 < argc) {
                const char *arg = argv[1];
                if (!strcmp(arg, "--missing-ok"))
-                       missing_ok = 1;
+                       flags |= WRITE_TREE_MISSING_OK;
                else if (!prefixcmp(arg, "--prefix="))
                        prefix = arg + 9;
+               else if (!prefixcmp(arg, "--ignore-cache-tree"))
+                       /*
+                        * This is only useful for debugging, so I
+                        * do not bother documenting it.
+                        */
+                       flags |= WRITE_TREE_IGNORE_CACHE_TREE;
                else
                        usage(write_tree_usage);
                argc--; argv++;
@@ -33,7 +39,7 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
        if (argc > 2)
                die("too many options");
 
-       ret = write_cache_as_tree(sha1, missing_ok, prefix);
+       ret = write_cache_as_tree(sha1, flags, prefix);
        switch (ret) {
        case 0:
                printf("%s\n", sha1_to_hex(sha1));