Skip to content

Commit

Permalink
get_remote_group(): handle remotes with single-character names
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Jul 28, 2015
1 parent 9a3d637 commit c26f7d7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,10 +978,9 @@ static int get_remote_group(const char *key, const char *value, void *priv)
/* split list by white space */
int space = strcspn(value, " \t\n");
while (*value) {
if (space > 1) {
if (space >= 1)
string_list_append(g->list,
xstrndup(value, space));
}
value += space + (value[space] != '\0');
space = strcspn(value, " \t\n");
}
Expand Down

0 comments on commit c26f7d7

Please sign in to comment.