]>
Commit | Line | Data |
---|---|---|
9370bae2 LS |
1 | /* |
2 | * GIT - The information manager from hell | |
3 | */ | |
4 | ||
5 | #include "cache.h" | |
6 | #include "refs.h" | |
7 | #include "builtin.h" | |
a31dca03 | 8 | #include "strbuf.h" |
9370bae2 | 9 | |
a633fca0 | 10 | int cmd_check_ref_format(int argc, const char **argv, const char *prefix) |
9370bae2 | 11 | { |
a31dca03 JH |
12 | if (argc == 3 && !strcmp(argv[1], "--branch")) { |
13 | struct strbuf sb = STRBUF_INIT; | |
a2fab531 JH |
14 | |
15 | if (strbuf_check_branch_ref(&sb, argv[2])) | |
a31dca03 JH |
16 | die("'%s' is not a valid branch name", argv[2]); |
17 | printf("%s\n", sb.buf + 11); | |
18 | exit(0); | |
19 | } | |
9370bae2 | 20 | if (argc != 2) |
34baebce | 21 | usage("git check-ref-format refname"); |
9370bae2 LS |
22 | return !!check_ref_format(argv[1]); |
23 | } |