]> git.ipfire.org Git - thirdparty/git.git/commitdiff
string-list: report programming error with BUG
authorJunio C Hamano <gitster@pobox.com>
Fri, 1 Aug 2025 22:04:17 +0000 (15:04 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Aug 2025 22:24:31 +0000 (15:24 -0700)
Passing a string list that has .strdup_strings bit unset to
string_list_split(), or one that has .strdup_strings bit set to
string_list_split_in_place(), is a programmer error.  Do not use
die() to abort the execution.  Use BUG() instead.

As a developer-facing message, the message string itself should
be a lot more concise, but let's keep the original one for now.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
string-list.c

index 53faaa84207bf90901a26ccc89217c44191ec352..0cb920e9b0d5200acd79b7de2a44e90bd613419a 100644 (file)
@@ -283,7 +283,7 @@ int string_list_split(struct string_list *list, const char *string,
        const char *p = string, *end;
 
        if (!list->strdup_strings)
-               die("internal error in string_list_split(): "
+               BUG("internal error in string_list_split(): "
                    "list->strdup_strings must be set");
        for (;;) {
                count++;
@@ -309,7 +309,7 @@ int string_list_split_in_place(struct string_list *list, char *string,
        char *p = string, *end;
 
        if (list->strdup_strings)
-               die("internal error in string_list_split_in_place(): "
+               BUG("internal error in string_list_split_in_place(): "
                    "list->strdup_strings must not be set");
        for (;;) {
                count++;