ignore first commit error

This commit is contained in:
AJ ONeal 2019-06-01 05:41:59 +00:00
parent f655ca4367
commit 8bdffa8302
1 changed files with 5 additions and 0 deletions

View File

@ -3,6 +3,7 @@ set -u
set -e set -e
ref_name=$1 ref_name=$1
old_rev=$2
new_rev=$3 new_rev=$3
# Here you can use whatever formatter you like # Here you can use whatever formatter you like
@ -51,6 +52,10 @@ refs/heads/*)
# #
# ex: /tmp/git-work-tree.abc123xyz # ex: /tmp/git-work-tree.abc123xyz
my_work_tree=$(mktemp -d -t git-work-tree.XXXXXXXX) 2>/dev/null my_work_tree=$(mktemp -d -t git-work-tree.XXXXXXXX) 2>/dev/null
if [ "$(expr "${old_rev}" : '0*$')" -ne 0 ]; then
# Ignore "fatal: You are on a branch yet to be born"
set +e
fi
git --work-tree="${my_work_tree}" --git-dir="." checkout -f >/dev/null git --work-tree="${my_work_tree}" --git-dir="." checkout -f >/dev/null
my_changes=$(git --work-tree="${my_work_tree}" --git-dir="." diff --name-status HEAD $new_rev) my_changes=$(git --work-tree="${my_work_tree}" --git-dir="." diff --name-status HEAD $new_rev)
if [ -n "$(echo "$my_changes" | grep -e "^A")" ]; then if [ -n "$(echo "$my_changes" | grep -e "^A")" ]; then