diff options
Diffstat (limited to 'builtin-check-ref-format.c')
-rw-r--r-- | builtin-check-ref-format.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin-check-ref-format.c b/builtin-check-ref-format.c index f9381e07ea..b97b61a0a4 100644 --- a/builtin-check-ref-format.c +++ b/builtin-check-ref-format.c @@ -17,6 +17,16 @@ int cmd_check_ref_format(int argc, const char **argv, const char *prefix) printf("%s\n", sb.buf + 11); exit(0); } + if (argc == 3 && !strcmp(argv[1], "--print")) { + char *refname = xmalloc(strlen(argv[2]) + 1); + + if (check_ref_format(argv[2])) + exit(1); + if (normalize_path_copy(refname, argv[2])) + die("Could not normalize ref name '%s'", argv[2]); + printf("%s\n", refname); + exit(0); + } if (argc != 2) usage("git check-ref-format refname"); return !!check_ref_format(argv[1]); |