Skip to content

Commit

Permalink
Fizes sync backup update status display
Browse files Browse the repository at this point in the history
  • Loading branch information
al3jandr0 committed Feb 2, 2024
1 parent ac6b7cc commit 1e5259c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v.0.5.6 - 2024-02-01

### Fixed

- Displays SUCCEED status on failed sync and backup

## v.0.5.5 - 2024-01-31

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions src/journal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set -e
set -o nounset
set -o pipefail
_ME="journalscript"
_VERSION="0.5.5"
_VERSION="0.5.6"
_COMMAND_LS="_ls"
_COMMAND_WRITE="_write"
_COMMAND_CONFIGURE="_configure"
Expand Down Expand Up @@ -448,8 +448,8 @@ _write() {
set +e
if [[ "git" == "$JOURNALSCRIPT_SYNC_BACKUP" ]]; then
if is_git_repo "$journal_dir"; then
git -C "$journal_dir" pull --rebase --quiet
local sync_status="SUCCEEDED"
git -C "$journal_dir" pull --rebase --quiet
if [ $? -eq 1 ]; then sync_status="FAILED"; fi
printf "==> Synched with git %s\n" "$sync_status"
# TODO: consider prompting the user when sync fails
Expand Down Expand Up @@ -497,10 +497,10 @@ _write() {
# if it is a git repo and there are changes.
if is_git_repo "$journal_dir"; then
if ! quiet_git -C "$journal_dir" diff --exit-code -s "$file_fp"; then
local backup_status="SUCCEEDED"
quiet_git -C "$journal_dir" add "$file_fp" &&
quiet_git -C "$journal_dir" commit --allow-empty-message -m "$info_msg" &&
quiet_git -C "$journal_dir" push
local backup_status="SUCCEEDED"
if [ $? -eq 1 ]; then backup_status="FAILED"; fi
printf "==> Backed up with git %s\n" "$backup_status"
fi
Expand Down

0 comments on commit 1e5259c

Please sign in to comment.