symbolic-ref -d: do not allow removal of HEAD
[gitweb.git] / parse-options.c
index 47a91920601d74842a0947ce1431c00b3d723972..312a85dbdef5723ef805917f5a556b75a55a7041 100644 (file)
@@ -110,6 +110,8 @@ static int get_value(struct parse_opt_ctx_t *p,
                return 0;
 
        case OPTION_COUNTUP:
+               if (*(int *)opt->value < 0)
+                       *(int *)opt->value = 0;
                *(int *)opt->value = unset ? 0 : *(int *)opt->value + 1;
                return 0;