summaryrefslogtreecommitdiff
path: root/pre-commit.sh
diff options
context:
space:
mode:
authorp4bl0 <r@uzy.me>2011-08-08 13:26:20 +0200
committerp4bl0 <r@uzy.me>2011-08-14 02:35:38 +0200
commit1f553d2f7c33aea2420dbb082a95509e0e279bbe (patch)
tree3a8159f9b3c47d5537dab2b3f2c032ffa43185a1 /pre-commit.sh
parent006260555956124bf11997e59dca4ee9e1351841 (diff)
fixed pre-commit hook
Diffstat (limited to 'pre-commit.sh')
-rw-r--r--pre-commit.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/pre-commit.sh b/pre-commit.sh
index ad4ee52..8e40b6e 100644
--- a/pre-commit.sh
+++ b/pre-commit.sh
@@ -2,18 +2,18 @@
articles_dir=`git config --get fugitive.articles-dir`
-article_exists=`mktemp fugitiveXXXXXX`
+article_exists="0"
for f in "$articles_dir"/*; do
+ if [ "$f" = "$articles_dir"'/*' ]; then break; fi
ts=`git log --format="%at" -- "$f" | tail -1`
if [ "$ts" != "" ]; then
- echo "1"
+ article_exists="1"
break
fi
-done > "$article_exists"
-article_exists=`cat $article_exists`
+done
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 '`git commit --no-verify` to bypass), aborting.' >&2
exit 1