On Thu, Jul 31, 2025 at 03:46:03PM -0700, Junio C Hamano wrote: > static int split_string(struct string_list *list, const char *string, const char *delim, > - int maxsplit, int in_place) > + int maxsplit, int in_place, unsigned flags) > { > int count = 0; > const char *p = string; > @@ -320,12 +327,18 @@ static int split_string(struct string_list *list, const char *string, const char > for (;;) { > char *end; > > + if (flags & STRING_LIST_SPLIT_TRIM) { > + /* ltrim */ > + while (*p && isspace(*p)) > + p++; > + } > + > if (0 <= maxsplit && maxsplit <= count) > end = NULL; > else > end = strpbrk(p, delim); > In `append_one`, we would tell whether `end` is NULL. I somehow feel strange why we need to do that in `append_one`. Should we just set `end` to be `p + strlen(p)` when `end` is NULL. And then we could do rtrim inside this function instead of `append_one` to avoid passing "flags" to `append_one`. > - count += append_one(list, p, end, in_place); > + count += append_one(list, p, end, in_place, flags); > > if (!end) > return count; Thanks, Jialuo