Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-07-28 22:25:45 +0300
committerJunio C Hamano <gitster@pobox.com>2017-07-29 01:51:56 +0300
commit2491f77b90c2e5d47acbe7472c17e7de0af74f63 (patch)
treeba20f55e5f188c839bb952f7b1a8428c370f9374 /path.c
parent2d90add5ad216807ec1433e5367fae730e74a4cb (diff)
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 <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path.c')
-rw-r--r--path.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/path.c b/path.c
index 8b7e168129..b214ac3fe6 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;