Improve variables available for pre-commit hooks

This commit is contained in:
Talia 2022-09-01 12:55:30 +02:00
parent 71e8ebbed5
commit 585d988a0b
1 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,7 @@ git checkout-index --prefix="$temp/index/" --all
cd $temp/index/ cd $temp/index/
if [ -n "$filter" ]; then if [ -n "$filter" ]; then
ln -s $WORK_DIR/.git/ .git ln -s "$WORK_DIR"/.git/ .git
sh -c "$filter" sh -c "$filter"
git add --all git add --all
rm .git rm .git
@ -71,14 +71,14 @@ if [ -n "$error" ]
then exit 1 then exit 1
fi fi
cd $WORK_DIR/.git cd "$WORK_DIR"/.git
rm -rf $temp rm -rf $temp
hook=$(basename $0) hook=$(basename $0)
if [ -f "$WORK_DIR/.git/hooks/$hook" ] if [ -f "$WORK_DIR/.git/hooks/$hook" ]
then then
echo Running project-level hook: $WORK_DIR/.git/hooks/$hook echo Running project-level hook: "$WORK_DIR"/.git/hooks/$hook
$WORK_DIR/.git/hooks/$hook "$WORK_DIR"/.git/hooks/$hook
error=$? error=$?
if [ -n "$error" ] if [ -n "$error" ]
then exit $error then exit $error