fixed pre-commit hook

This commit is contained in:
p4bl0 2011-08-08 13:26:20 +02:00
parent 0062605559
commit 1f553d2f7c
1 changed files with 5 additions and 5 deletions

View File

@ -2,18 +2,18 @@
articles_dir=`git config --get fugitive.articles-dir` articles_dir=`git config --get fugitive.articles-dir`
article_exists=`mktemp fugitiveXXXXXX` article_exists="0"
for f in "$articles_dir"/*; do for f in "$articles_dir"/*; do
if [ "$f" = "$articles_dir"'/*' ]; then break; fi
ts=`git log --format="%at" -- "$f" | tail -1` ts=`git log --format="%at" -- "$f" | tail -1`
if [ "$ts" != "" ]; then if [ "$ts" != "" ]; then
echo "1" article_exists="1"
break break
fi fi
done > "$article_exists" done
article_exists=`cat $article_exists`
non_tracked=`git status --porcelain | grep -E '^(A|R)' | grep "$articles_dir"` non_tracked=`git status --porcelain | grep -E '^(A|R)' | grep "$articles_dir"`
if [ "$article_exists" = "" -a "$non_tracked" = "" ]; then if [ "$article_exists" = "0" -a "$non_tracked" = "" ]; then
echo -n "[fugitive] ERROR: need at least one article (you can use " >&2 echo -n "[fugitive] ERROR: need at least one article (you can use " >&2
echo '`git commit --no-verify` to bypass), aborting.' >&2 echo '`git commit --no-verify` to bypass), aborting.' >&2
exit 1 exit 1