Re: [PATCH v2] Extend sample pre-commit hook to check for non ascii filenames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Heiko Voigt <hvoigt@xxxxxxxxxx> writes:

> diff --git a/templates/hooks--pre-commit.sample b/templates/hooks--pre-commit.sample
> index 0e49279..3083735 100755
> --- a/templates/hooks--pre-commit.sample
> +++ b/templates/hooks--pre-commit.sample
> @@ -7,6 +7,26 @@
>  #
>  # To enable this hook, rename this file to "pre-commit".
>  
> +# If you want to allow non-ascii filenames set this variable to true.
> +allownonascii=$(git config hooks.allownonascii)
> +
> +function is_ascii () {

We do not say "#!/bin/bash" at the beginning (hopefully), so let's not say
"function " here.

> +    test -z "$(cat | sed -e "s/[\ -~]*//g")"

Do you need "cat | "?

Does this script run under LC_ALL=C?  Can an i18n'ized sed interfere with
what you are trying to do?

> +    return $?

Do you need this, or does the function return the result of the last
statment anyway?

> +		echo "Non-ascii filenames are not allowed !"
> +		echo "Please rename the file ..."

Can we make this sound more like a _sample_ project policy?  It's not like
we enforce that policy to other people's projects.

> +		exit 1
> +	fi
> +fi
> +
>  if git-rev-parse --verify HEAD 2>/dev/null
>  then
>  	against=HEAD
> -- 
> 1.6.3
--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]