Skip to content

Commit

Permalink
Allow theme.sh being run without commit
Browse files Browse the repository at this point in the history
  • Loading branch information
su-ex committed Jan 26, 2022
1 parent 44fce0c commit f3da66a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions theme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
shopt -s globstar

mydir="$(dirname "$(realpath "$0")")"
automatic_commit="$1"

# Require clean git state
uncommitted=`git status --porcelain`
if [ ! -z "$uncommitted" ]; then
echo "Uncommitted changes are present, please commit first!"
exit 1
if [[ "$automatic_commit" == [Yy]* ]]; then
# Require clean git state
uncommitted=`git status --porcelain`
if [ ! -z "$uncommitted" ]; then
echo "Uncommitted changes are present, please commit first!"
exit 1
fi
fi

pushd "$mydir" > /dev/null
Expand Down Expand Up @@ -131,6 +134,8 @@ done

popd > /dev/null

# see: https://devops.stackexchange.com/a/5443
git add -A
git diff-index --quiet HEAD || git commit -m "Automatic theme update"
if [[ "$automatic_commit" == [Yy]* ]]; then
# see: https://devops.stackexchange.com/a/5443
git add -A
git diff-index --quiet HEAD || git commit -m "Automatic theme update"
fi

0 comments on commit f3da66a

Please sign in to comment.