From: Junio C Hamano Date: Wed, 11 May 2016 01:11:19 GMT Subject: Re: [PATCH 1/7] submodule--helper: add valid-label-name Message-ID: In-Reply-To: <1462928397-1708-2-git-send-email-sbeller@google.com> Stefan Beller writes: > +static int submodule_valid_label_name(const char *label) > +{ > + if (!label || !strlen(label)) > + return 0; > + > + if (!isalnum(*label)) > + return 0; I'd limit this one to isalpha() if I were doing this to make the restriction similar to identifiers in traditional programming language. > + while (*label) { > + if (!(isalnum(*label) || > + *label == '-')) And throw in '_' to the mix while at it. > + return 0; > + label++; > + } > + > + return 1; > +} If the convention is "0 is good", then please signal "bad" with a negative value, not just "non-zero".