-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Dev Mode option for git diff creation
- Loading branch information
1 parent
6c649de
commit 61e23b6
Showing
1 changed file
with
32 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -904,34 +904,38 @@ if [ "$CURRENT_REPO" != "$DEFAULT_REPO" ]; then | |
fi | ||
fi | ||
|
||
echo -e "\e[32mCommitting current status...\e[0m" | ||
[[ -z "$(git config user.name)" ]] && git config user.name moo | ||
[[ -z "$(git config user.email)" ]] && git config user.email [email protected] | ||
[[ ! -z $(git ls-files data/conf/rspamd/override.d/worker-controller-password.inc) ]] && git rm data/conf/rspamd/override.d/worker-controller-password.inc | ||
git add -u | ||
git commit -am "Before update on ${DATE}" > /dev/null | ||
echo -e "\e[32mFetching updated code from remote...\e[0m" | ||
git fetch origin #${BRANCH} | ||
echo -e "\e[32mMerging local with remote code (recursive, strategy: \"${MERGE_STRATEGY:-theirs}\", options: \"patience\"...\e[0m" | ||
git config merge.defaultToUpstream true | ||
git merge -X${MERGE_STRATEGY:-theirs} -Xpatience -m "After update on ${DATE}" | ||
# Need to use a variable to not pass return codes of if checks | ||
MERGE_RETURN=$? | ||
if [[ ${MERGE_RETURN} == 128 ]]; then | ||
echo -e "\e[31m\nOh no, what happened?\n=> You most likely added files to your local mailcow instance that were now added to the official mailcow repository. Please move them to another location before updating mailcow.\e[0m" | ||
exit 1 | ||
elif [[ ${MERGE_RETURN} == 1 ]]; then | ||
echo -e "\e[93mPotenial conflict, trying to fix...\e[0m" | ||
git status --porcelain | grep -E "UD|DU" | awk '{print $2}' | xargs rm -v | ||
git add -A | ||
git commit -m "After update on ${DATE}" > /dev/null | ||
git checkout . | ||
echo -e "\e[32mRemoved and recreated files if necessary.\e[0m" | ||
elif [[ ${MERGE_RETURN} != 0 ]]; then | ||
echo -e "\e[31m\nOh no, something went wrong. Please check the error message above.\e[0m" | ||
echo | ||
echo "Run $COMPOSE_COMMAND up -d to restart your stack without updates or try again after fixing the mentioned errors." | ||
exit 1 | ||
if [ ! $DEV ]; then | ||
echo -e "\e[32mCommitting current status...\e[0m" | ||
[[ -z "$(git config user.name)" ]] && git config user.name moo | ||
[[ -z "$(git config user.email)" ]] && git config user.email [email protected] | ||
[[ ! -z $(git ls-files data/conf/rspamd/override.d/worker-controller-password.inc) ]] && git rm data/conf/rspamd/override.d/worker-controller-password.inc | ||
git add -u | ||
git commit -am "Before update on ${DATE}" > /dev/null | ||
echo -e "\e[32mFetching updated code from remote...\e[0m" | ||
git fetch origin #${BRANCH} | ||
echo -e "\e[32mMerging local with remote code (recursive, strategy: \"${MERGE_STRATEGY:-theirs}\", options: \"patience\"...\e[0m" | ||
git config merge.defaultToUpstream true | ||
git merge -X${MERGE_STRATEGY:-theirs} -Xpatience -m "After update on ${DATE}" | ||
# Need to use a variable to not pass return codes of if checks | ||
MERGE_RETURN=$? | ||
if [[ ${MERGE_RETURN} == 128 ]]; then | ||
echo -e "\e[31m\nOh no, what happened?\n=> You most likely added files to your local mailcow instance that were now added to the official mailcow repository. Please move them to another location before updating mailcow.\e[0m" | ||
exit 1 | ||
elif [[ ${MERGE_RETURN} == 1 ]]; then | ||
echo -e "\e[93mPotenial conflict, trying to fix...\e[0m" | ||
git status --porcelain | grep -E "UD|DU" | awk '{print $2}' | xargs rm -v | ||
git add -A | ||
git commit -m "After update on ${DATE}" > /dev/null | ||
git checkout . | ||
echo -e "\e[32mRemoved and recreated files if necessary.\e[0m" | ||
elif [[ ${MERGE_RETURN} != 0 ]]; then | ||
echo -e "\e[31m\nOh no, something went wrong. Please check the error message above.\e[0m" | ||
echo | ||
echo "Run $COMPOSE_COMMAND up -d to restart your stack without updates or try again after fixing the mentioned errors." | ||
exit 1 | ||
fi | ||
elif [ $DEV ]; then | ||
echo -e "\e[33mDEVELOPER MODE: Not creating a git diff and commiting it to prevent development stuff within a backup diff...\e[0m" | ||
fi | ||
|
||
echo -e "\e[32mFetching new images, if any...\e[0m" | ||
|