X-Git-Url: https://git.armaanb.net/?a=blobdiff_plain;f=example_post-receive.sh;h=c9bcb5e61d048a455652c5d197486bfd82b2e1a2;hb=06b73aa8f76fe73d27eaca98e6e814428b0eac09;hp=5f827e109da42361bf00d4fbba7af00538f7701e;hpb=bdcf38baa40fd508a9b890afb0a75e53f0819a37;p=stagit.git diff --git a/example_post-receive.sh b/example_post-receive.sh index 5f827e1..c9bcb5e 100755 --- a/example_post-receive.sh +++ b/example_post-receive.sh @@ -8,9 +8,13 @@ # if name is not set the basename of the current directory is used, # this is the directory of the repo when called from the post-receive script. +# NOTE: needs to be set for correct locale (expects UTF-8) otherwise the +# default is LC_CTYPE="POSIX". +export LC_CTYPE="en_US.UTF-8" + name="$1" if test "${name}" = ""; then - name=$(basename $(pwd)) + name=$(basename "$(pwd)") fi # config @@ -32,6 +36,9 @@ cd "${dir}" || exit 1 # detect git push -f force=0 while read -r old new ref; do + test "${old}" = "0000000000000000000000000000000000000000" && continue + test "${new}" = "0000000000000000000000000000000000000000" && continue + hasrevs=$(git rev-list "${old}" "^${new}" | sed 1q) if test -n "${hasrevs}"; then force=1