Skip to content

Commit

Permalink
Error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
b3nj5m1n committed Nov 29, 2023
1 parent b6d2ed3 commit e2c6b45
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions scripts/auto_commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ EMAIL=""

unalias -a

fuckup() {
echo "runnign test"
cd "$REPO_DIR" || exit 1
echo "$PWD"
if git rev-parse --verify -q REBASE_HEAD >/dev/null 2>&1 \
|| git rev-parse --verify -q MERGE_HEAD >/dev/null 2>&1 \
|| [ "$(cd "$REPO_DIR" && git diff --name-only --diff-filter=U --relative | head -c1 | wc -c)" -ne 0 ] \
; then
XDG_RUNTIME_DIR=/run/user/$(id -u) notify-send -u "critical" --wait "Something's gone very wrong: $REPO_DIR"&
exit 1
fi
}
fuckup

notify() {
if [ "$SILENT" != true ]; then
if command -v termux-setup-storage; then
Expand Down Expand Up @@ -42,9 +56,7 @@ if [ "$(git status --porcelain)" ]; then
cd "$REPO_DIR" && git -c user.name="$GIT_COMMITTER_NAME" -c user.email="$GIT_COMMITTER_EMAIL" commit --no-gpg-sign --author "$AUTHOR" -m "$MESSAGE" || notify "Failed committing changes in $REPO_DIR"
cd "$REPO_DIR" && printf "%s\n" "$SSH_PW" | git push || notify "Failed pushing changes in $REPO_DIR"
fi
if [ "$(cd "$REPO_DIR" && git diff --name-only --diff-filter=U --relative | head -c1 | wc -c)" -ne 0 ]; then
XDG_RUNTIME_DIR=/run/user/$(id -u) notify-send -u "critical" --wait "Something's gone very wrong: $REPO_DIR"
fi
fuckup

notify "Done updating changes in $REPO_DIR"

Expand Down

0 comments on commit e2c6b45

Please sign in to comment.