mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
string-list: split-then-remove-empty can be done while splitting
Thanks to the new STRING_LIST_SPLIT_NONEMPTY flag, a common pattern to split a string into a string list and then remove empty items in the resulting list is no longer needed. Instead, just tell the string_list_split*() to omit empty ones while splitting. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@@ -201,8 +201,7 @@ static void parse_pathspec_attr_match(struct pathspec_item *item, const char *va
|
||||
if (!value || !*value)
|
||||
die(_("attr spec must not be empty"));
|
||||
|
||||
string_list_split(&list, value, " ", -1);
|
||||
string_list_remove_empty_items(&list, 0);
|
||||
string_list_split_f(&list, value, " ", -1, STRING_LIST_SPLIT_NONEMPTY);
|
||||
|
||||
item->attr_check = attr_check_alloc();
|
||||
CALLOC_ARRAY(item->attr_match, list.nr);
|
||||
|
||||
Reference in New Issue
Block a user