[PATCH 08/24] Show usage string for 'git check-ref-format -h'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 builtin-check-ref-format.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/builtin-check-ref-format.c b/builtin-check-ref-format.c
index 513f134..b106c65 100644
--- a/builtin-check-ref-format.c
+++ b/builtin-check-ref-format.c
@@ -35,6 +35,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;
 
-- 
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]