]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/rev-parse.c
rev-parse: add a --show-object-format option
[thirdparty/git.git] / builtin / rev-parse.c
index f8bbe6d47ec397f55bec62d6a71bc6db8f08b54b..6c5d5d6a70f9c8834801dd309e111d72df2a3e31 100644 (file)
@@ -918,6 +918,17 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                                show_datestring("--min-age=", arg);
                                continue;
                        }
+                       if (opt_with_value(arg, "--show-object-format", &arg)) {
+                               const char *val = arg ? arg : "storage";
+
+                               if (strcmp(val, "storage") &&
+                                   strcmp(val, "input") &&
+                                   strcmp(val, "output"))
+                                       die("unknown mode for --show-object-format: %s",
+                                           arg);
+                               puts(the_hash_algo->name);
+                               continue;
+                       }
                        if (show_flag(arg) && verify)
                                die_no_single_rev(quiet);
                        continue;