fetch-pack: eliminate spurious error messages
[gitweb.git] / builtin / for-each-ref.c
index afe83b984354913d348bf58de04c4b2bd5d307af..7f059c31dfbd11f77c891134ccc34cdc1f65bcb8 100644 (file)
@@ -962,7 +962,9 @@ static int opt_parse_sort(const struct option *opt, const char *arg, int unset)
        if (!arg) /* should --no-sort void the list ? */
                return -1;
 
-       *sort_tail = s = xcalloc(1, sizeof(*s));
+       s = xcalloc(1, sizeof(*s));
+       s->next = *sort_tail;
+       *sort_tail = s;
 
        if (*arg == '-') {
                s->reverse = 1;