2010-08-10 22:25:11 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
articles_dir=`git config --get fugitive.articles-dir`
|
|
|
|
|
2011-08-08 13:26:20 +02:00
|
|
|
article_exists="0"
|
2010-08-10 22:25:11 +02:00
|
|
|
for f in "$articles_dir"/*; do
|
2011-08-08 13:26:20 +02:00
|
|
|
if [ "$f" = "$articles_dir"'/*' ]; then break; fi
|
2010-08-10 22:25:11 +02:00
|
|
|
ts=`git log --format="%at" -- "$f" | tail -1`
|
|
|
|
if [ "$ts" != "" ]; then
|
2011-08-08 13:26:20 +02:00
|
|
|
article_exists="1"
|
2010-08-10 22:25:11 +02:00
|
|
|
break
|
|
|
|
fi
|
2011-08-08 13:26:20 +02:00
|
|
|
done
|
2010-08-10 22:25:11 +02:00
|
|
|
non_tracked=`git status --porcelain | grep -E '^(A|R)' | grep "$articles_dir"`
|
|
|
|
|
2011-08-08 13:26:20 +02:00
|
|
|
if [ "$article_exists" = "0" -a "$non_tracked" = "" ]; then
|
2010-08-10 22:25:11 +02:00
|
|
|
echo -n "[fugitive] ERROR: need at least one article (you can use " >&2
|
|
|
|
echo '`git commit --no-verify` to bypass), aborting.' >&2
|
|
|
|
exit 1
|
|
|
|
fi
|