diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-08-01 15:04:22 -0700 | 
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-08-02 22:34:45 -0700 | 
| commit | 27531efa41cfa882473513dd93e696a16f6eb87b (patch) | |
| tree | 262567942f856b61a9a7f29ef210dc526c0b5293 /string-list.c | |
| parent | f3a303aef017ad6e53fa44643d832a1fa0de0d91 (diff) | |
string-list: optionally omit empty string pieces in string_list_split*()
Teach the unified split_string() machinery a new flag bit,
STRING_LIST_SPLIT_NONEMPTY, to cause empty split pieces to be
omitted from the resulting string list.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'string-list.c')
| -rw-r--r-- | string-list.c | 3 | 
1 files changed, 3 insertions, 0 deletions
diff --git a/string-list.c b/string-list.c index 86a309f8fb..343cf1ca90 100644 --- a/string-list.c +++ b/string-list.c @@ -294,6 +294,9 @@ static int append_one(struct string_list *list,  				break;  	} +	if ((flags & STRING_LIST_SPLIT_NONEMPTY) && (end <= p)) +		return 0; +  	if (in_place) {  		*((char *)end) = '\0';  		string_list_append(list, p);  | 
