Code cleanup

This commit is contained in:
Pierre Pronchery 2014-09-10 21:55:06 +02:00
parent baa2821eb0
commit 4a9a8cc4de

View File

@ -21,6 +21,10 @@
PROGNAME="deforaos-git-hook.sh" PROGNAME="deforaos-git-hook.sh"
#executables #executables
GIT="git" GIT="git"
SED="sed"
SORT="sort"
UNIQ="uniq"
WC="wc"
#functions #functions
@ -97,9 +101,9 @@ _hook_update()
#count the number of commits #count the number of commits
commit_cnt=$((commit_cnt + 1)) commit_cnt=$((commit_cnt + 1))
done done
all_files=$(echo "$all_files" | sed -e '/^$/d') all_files=$(echo "$all_files" | $SED -e '/^$/d')
files_cnt=$(echo "$all_files" | wc -l) files_cnt=$(echo "$all_files" | $WC -l)
unique_files_cnt=$(echo "$all_files" | sort | uniq | wc -l) unique_files_cnt=$(echo "$all_files" | $SORT | $UNIQ | $WC -l)
if [ -n "$branch" ]; then if [ -n "$branch" ]; then
if [ $commit_cnt -eq 1 -a -n "$message" ]; then if [ $commit_cnt -eq 1 -a -n "$message" ]; then
echo "$repository: $author [$branch] $message ($files_cnt alterations in $unique_files_cnt files)" echo "$repository: $author [$branch] $message ($files_cnt alterations in $unique_files_cnt files)"