Skip to content

Commit 71f59a6

Browse files
committed
handle error in diff check
1 parent 96676d2 commit 71f59a6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

deploy.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ git --work-tree "$deploy_directory" reset --mixed --quiet
4040

4141
git --work-tree "$deploy_directory" add --all
4242

43-
if git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD; then
44-
echo No changes to files in $deploy_directory. Skipping commit.
45-
else
46-
set_user_id
47-
git --work-tree "$deploy_directory" commit -m \
48-
"publish: $commit_title"$'\n\n'"generated from commit $commit_hash"
49-
git push origin $deploy_branch
50-
fi
43+
case `git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD` in
44+
0) echo No changes to files in $deploy_directory. Skipping commit.;;
45+
1)
46+
set_user_id
47+
git --work-tree "$deploy_directory" commit -m \
48+
"publish: $commit_title"$'\n\n'"generated from commit $commit_hash"
49+
git push origin $deploy_branch
50+
;;
51+
*) exit 1;;
52+
esac
5153

5254
if [[ $previous_branch = "HEAD" ]]; then
5355
#we weren't on any branch before, so just set HEAD back to the commit it was on

0 commit comments

Comments
 (0)