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>
Jonathan Nieder committed
Nov 9, 2009 at 09:04 UTC
aeda85a81547b05c36939defb420e5f02bf05e51
1 file changed
+3
builtin-check-ref-format.c
+3
@@ -31,6 +31,9 @@ static void collapse_slashes(char *dst, const char *src)
31
32
int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
33
{
34
+ if (argc == 2 && !strcmp(argv[1], "-h"))
35
+ usage(builtin_check_ref_format_usage);
36
+
37
if (argc == 3 && !strcmp(argv[1], "--branch")) {
38
struct strbuf sb = STRBUF_INIT;
39