Start adding interfaces to read in partial trees
[git.git] / diff-cache.c
index 603a6b7..d78cbb5 100644 (file)
@@ -159,7 +159,9 @@ static void mark_merge_entries(void)
 }
 
 static char *diff_cache_usage =
-"git-diff-cache [-p] [-r] [-z] [-m] [--cached] [-R] [-B] [-M] [-C] [--find-copies-harder] [-O<orderfile>] [-S<string>] [--pickaxe-all] <tree-ish> [<path>...]";
+"git-diff-cache [-m] [--cached] "
+"[<common diff options>] <tree-ish> [<path>...]"
+COMMON_DIFF_OPTIONS_HELP;
 
 int main(int argc, const char **argv)
 {
@@ -193,7 +195,8 @@ int main(int argc, const char **argv)
                        /* We accept the -r flag just to look like git-diff-tree */
                        continue;
                }
-               if (!strcmp(arg, "-p")) {
+               /* We accept the -u flag as a synonym for "-p" */
+               if (!strcmp(arg, "-p") || !strcmp(arg, "-u")) {
                        diff_output_format = DIFF_FORMAT_PATCH;
                        continue;
                }
@@ -222,6 +225,14 @@ int main(int argc, const char **argv)
                        diff_output_format = DIFF_FORMAT_MACHINE;
                        continue;
                }
+               if (!strcmp(arg, "--name-only")) {
+                       diff_output_format = DIFF_FORMAT_NAME;
+                       continue;
+               }
+               if (!strcmp(arg, "--name-only-z")) {
+                       diff_output_format = DIFF_FORMAT_NAME_Z;
+                       continue;
+               }
                if (!strcmp(arg, "-R")) {
                        diff_setup_opt |= DIFF_SETUP_REVERSE;
                        continue;
@@ -267,7 +278,7 @@ int main(int argc, const char **argv)
        tree = read_object_with_reference(sha1, "tree", &size, NULL);
        if (!tree)
                die("bad tree object %s", tree_name);
-       if (read_tree(tree, size, 1))
+       if (read_tree(tree, size, 1, NULL))
                die("unable to read tree object %s", tree_name);
 
        ret = diff_cache(active_cache, active_nr);