From 2491f77b90c2e5d47acbe7472c17e7de0af74f63 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 28 Jul 2017 15:25:45 -0400 Subject: connect: factor out "looks like command line option" check We reject hostnames that start with a dash because they may be confused for command-line options. Let's factor out that notion into a helper function, as we'll use it in more places. And while it's simple now, it's not clear if some systems might need more complex logic to handle all cases. Signed-off-by: Jeff King Reviewed-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- path.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'path.c') diff --git a/path.c b/path.c index 8b7e16812..b214ac3fe 100644 --- a/path.c +++ b/path.c @@ -1178,6 +1178,11 @@ int is_ntfs_dotgit(const char *name) } } +int looks_like_command_line_option(const char *str) +{ + return str && str[0] == '-'; +} + char *xdg_config_home(const char *filename) { const char *home, *config_home; -- cgit v1.2.1