Thanks for the great, straightforward tool! After the last upgrade a colleague has been seeing the following:
check-conflicts: git is not allowed in parallel hooks (git diff --cached --name-only -G<<<<<|=====|>>>>>)
In our hooks we're accessing git in a way that I believe can be parallel (I may be wrong):
#!/bin/bash
# Simple check for merge conflics
conflicts=`git diff --cached --name-only -G"<<<<<|=====|>>>>>"`
# Something went wrong
if [[ -n "$conflicts" ]]; then
echo
echo "Unresolved merge conflicts in these files:"
for conflict in $conflicts; do
echo $conflict
done;
exit 1;
fi
exit 0
or
#!/bin/bash
# Checks the the staged JSON files are valid JSON
#
# There may be a better way to do this, but for now it works by calling
# 'python -m json.tool' on the file, which will exit with a non-zero status if
# the json is invalid:
#
# $ echo "{" | python -m json.tool
# Expecting property name enclosed in double quotes: line 2 column 1 (char 2)
files=$(git diff --cached --name-status | awk '$1 != "D" && $NF ~ /\.json$/ { print $NF }')
for file in $files; do
echo "$file"
git show :$file $file | python -m json.tool > /dev/null || exit 1
done;
It's always a combination of git diff or git show. Are those really risky to use in parallel hooks?
(weirdly only the check-conflicts hook warns)
Thanks for the great, straightforward tool! After the last upgrade a colleague has been seeing the following:
In our hooks we're accessing git in a way that I believe can be parallel (I may be wrong):
or
It's always a combination of git diff or git show. Are those really risky to use in parallel hooks?
(weirdly only the check-conflicts hook warns)