diff options
-rw-r--r-- | refs.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -1709,13 +1709,19 @@ int ref_update_reject_duplicates(struct string_list *refnames, assert(err); - for (i = 1; i < n; i++) - if (!strcmp(refnames->items[i - 1].string, refnames->items[i].string)) { + for (i = 1; i < n; i++) { + int cmp = strcmp(refnames->items[i - 1].string, + refnames->items[i].string); + + if (!cmp) { strbuf_addf(err, "multiple updates for ref '%s' not allowed.", refnames->items[i].string); return 1; + } else if (cmp > 0) { + die("BUG: ref_update_reject_duplicates() received unsorted list"); } + } return 0; } |