Code

Merge branch 'jc/maint-am-keep'
[git.git] / builtin-check-ref-format.c
index e3e7bdf52f0b1f597e6cfd3affcf75f41f183d75..b106c65d80dfc8fe794d46e34ea1ff78b04f3056 100644 (file)
@@ -7,6 +7,10 @@
 #include "builtin.h"
 #include "strbuf.h"
 
+static const char builtin_check_ref_format_usage[] =
+"git check-ref-format [--print] <refname>\n"
+"   or: git check-ref-format --branch <branchname-shorthand>";
+
 /*
  * Replace each run of adjacent slashes in src with a single slash,
  * and write the result to dst.
@@ -31,6 +35,9 @@ static void collapse_slashes(char *dst, const char *src)
 
 int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
 {
+       if (argc == 2 && !strcmp(argv[1], "-h"))
+               usage(builtin_check_ref_format_usage);
+
        if (argc == 3 && !strcmp(argv[1], "--branch")) {
                struct strbuf sb = STRBUF_INIT;
 
@@ -49,6 +56,6 @@ int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
                exit(0);
        }
        if (argc != 2)
-               usage("git check-ref-format refname");
+               usage(builtin_check_ref_format_usage);
        return !!check_ref_format(argv[1]);
 }