Merge branch 'sb/maint-1.6.2-opt-filename-fix'
[git/git-svn.git] / builtin-check-ref-format.c
blobf9381e07eaeda673e91ef6250eca4027c5ba0278
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 int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
12 if (argc == 3 && !strcmp(argv[1], "--branch")) {
13 struct strbuf sb = STRBUF_INIT;
15 if (strbuf_check_branch_ref(&sb, argv[2]))
16 die("'%s' is not a valid branch name", argv[2]);
17 printf("%s\n", sb.buf + 11);
18 exit(0);
20 if (argc != 2)
21 usage("git check-ref-format refname");
22 return !!check_ref_format(argv[1]);