summaryrefslogtreecommitdiff
path: root/builtin-check-ref-format.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2009-11-09 09:04:48 -0600
committerJunio C Hamano <gitster@pobox.com>2009-11-10 11:06:56 -0800
commitaeda85a81547b05c36939defb420e5f02bf05e51 (patch)
treee2a812b46e87813fec65932762e60b4bfd8f8f42 /builtin-check-ref-format.c
parente62b393505616c3ce313f6dac5060d9e1cde8e42 (diff)
downloadgit-aeda85a81547b05c36939defb420e5f02bf05e51.tar.gz
Show usage string for 'git check-ref-format -h'
This only changes the behavior of "git check-ref-format -h" without any other options and arguments. This change cannot be breaking backward compatibility, since any valid refname must contain a /. Most existing scripts use arguments such as "heads/$foo". If some script checks the refname "-h" alone, git check-ref-format will still exit with nonzero status, and the only detrimental side-effect will be a usage string sent to stderr. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-check-ref-format.c')
-rw-r--r--builtin-check-ref-format.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin-check-ref-format.c b/builtin-check-ref-format.c
index e3e7bdf52f..0a576afd0e 100644
--- a/builtin-check-ref-format.c
+++ b/builtin-check-ref-format.c
@@ -31,6 +31,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;