2
0
mirror of https://github.com/gitwatch/gitwatch synced 2024-11-17 03:25:41 +00:00

CD to directory, before checking status

This commit is contained in:
Bryan Moffit 2017-09-27 12:55:26 -04:00
parent f260d6f60f
commit 209d24912a

View File

@ -175,9 +175,9 @@ while true; do
if [ -n "$DATE_FMT" ]; then
FORMATTED_COMMITMSG="$(sed "s/%d/$(date "$DATE_FMT")/" <<< "$COMMITMSG")" # splice the formatted date-time into the commit message
fi
cd $TARGETDIR # CD into right dir
STATUS=$($GIT status -s)
if [ -n "$STATUS" ]; then # only commit if status shows tracked changes.
cd $TARGETDIR # CD into right dir
$GIT add $GIT_ADD_ARGS # add file(s) to index
$GIT commit $GIT_COMMIT_ARGS -m"$FORMATTED_COMMITMSG" # construct commit message and commit