get_remote_group(): handle remotes with single-character names
The code for splitting a whitespace-separated list of values in "remotes.<name>" had an off-by-one error that caused it to skip over remotes whose names consist of a single character. Also remove unnecessary braces. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
9a3d637541
commit
c26f7d7b26
|
|
@ -978,10 +978,9 @@ static int get_remote_group(const char *key, const char *value, void *priv)
|
||||||
/* split list by white space */
|
/* split list by white space */
|
||||||
int space = strcspn(value, " \t\n");
|
int space = strcspn(value, " \t\n");
|
||||||
while (*value) {
|
while (*value) {
|
||||||
if (space > 1) {
|
if (space >= 1)
|
||||||
string_list_append(g->list,
|
string_list_append(g->list,
|
||||||
xstrndup(value, space));
|
xstrndup(value, space));
|
||||||
}
|
|
||||||
value += space + (value[space] != '\0');
|
value += space + (value[space] != '\0');
|
||||||
space = strcspn(value, " \t\n");
|
space = strcspn(value, " \t\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue