From 24b6177e0261efba063c0b83ae0cdc5993945da9 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sun, 13 Apr 2008 11:56:54 +0200 Subject: git-remote: reject adding remotes with invalid names This can happen if the arguments to git-remote add is switched by the user, and git would only show an error if fetching was also requested. Fix it by using the refspec parsing engine to check if the requested name can be parsed as a remote before add it. Also cleanup so that the "remote..url" config name buffer is only initialized once. Signed-off-by: Jonas Fonseca Signed-off-by: Junio C Hamano --- remote.h | 1 + 1 file changed, 1 insertion(+) (limited to 'remote.h') diff --git a/remote.h b/remote.h index 7e9ae792dc..a38774bbdc 100644 --- a/remote.h +++ b/remote.h @@ -67,6 +67,7 @@ void free_refs(struct ref *ref); */ void ref_remove_duplicates(struct ref *ref_map); +int valid_fetch_refspec(const char *refspec); struct refspec *parse_fetch_refspec(int nr_refspec, const char **refspec); struct refspec *parse_push_refspec(int nr_refspec, const char **refspec); -- cgit v1.2.3