On Mon, May 18, 2009 at 12:40:09PM +0200, Johannes Sixt wrote: > Heiko Voigt schrieb: > > +# is_ascii() Tests the string given given on standard input for > > +# printable ascii conformance. We exploit the fact that the printable > > +# range starts at the space character and ends with tilde. > > +is_ascii() { > > + test -z "$(LC_ALL=C tr -d \ -~)" > > +} > > + > > +if [ "$allownonascii" != "true" ] > > +then > > + # until git can handle non-ascii filenames gracefully > > + # prevent them to be added into the repository > > + if ! git diff --cached --name-only --diff-filter=A -z \ > > + | tr "\0" "\n" | is_ascii; then > > Will this not fail to add more than one file with allowed names? The \n is > not removed in is_ascii(), and so the resulting string will not be empty. No currently it does not. At least on my system, but good point. > BTW, not all tr work well with NULs. See the commit message of e85fe4d8, > for example. Otherwise, I would have suggested to convert the NUL to some > allowed ASCII character, e.g. 'A'. BTW, you should really use '\0' and > '\n' (single-quotes) to guarantee that the shell does not ignore the > backslash. Are there any problems with '\0' and tr other than swallowing of it. In case not I would just change tr "\0" "\n" to tr -d '\0' That way there are no '\n's left over and it doesn't matter if tr swallows the '\0'. Waiting for further comments before sending the cleanup. cheers Heiko -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html