Documentation/Makefile: allow man.base.url.for.relative.link to be set from Make
[tgit.git] / builtin-check-ref-format.c
bloba5ba4eae5abb37fc5ed0b0ed5c704342d7cdb532
1 /*
2 * GIT - The information manager from hell
3 */
5 #include "cache.h"
6 #include "refs.h"
7 #include "builtin.h"
8 #include "strbuf.h"
10 static const char builtin_check_ref_format_usage[] =
11 "git check-ref-format <refname>\n"
12 " or: git check-ref-format --branch <branchname-shorthand>";
14 int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
16 if (argc == 3 && !strcmp(argv[1], "--branch")) {
17 struct strbuf sb = STRBUF_INIT;
19 if (strbuf_check_branch_ref(&sb, argv[2]))
20 die("'%s' is not a valid branch name", argv[2]);
21 printf("%s\n", sb.buf + 11);
22 exit(0);
24 if (argc != 2)
25 usage(builtin_check_ref_format_usage);
26 return !!check_ref_format(argv[1]);