Skip to content

Commit

Permalink
Trivial shellcheck fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ctubbsii committed Aug 29, 2020
1 parent 18e9ae6 commit 38cb886
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions git-sync
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# git-sync
# https://github.com/ctubbsii/git-sync
GIT_SYNC_VERSION='1.2.0'
GIT_SYNC_VERSION='1.2.1'

# catch most errors
set -eE
Expand All @@ -34,10 +34,12 @@ function relDir() {
local orig=$1 rel
# allow override
if [[ -n $GIT_SYNC_ABS_DIRS ]]; then echo "$orig"; return 0; fi
# shellcheck disable=SC2088 # tilde intended literally, expansion not expected
# tilde intended literally, expansion not expected
# shellcheck disable=SC2088
rel="~/$(realpath --relative-to="$(cd ~ && pwd)" "$orig" 2>/dev/null)" || rel=$orig
# never make the current directory relative and avoid ../
# shellcheck disable=SC2088 # tilde intended literally, expansion not expected
# tilde intended literally, expansion not expected
# shellcheck disable=SC2088
if [[ ${#orig} -le ${#rel} || $rel == '~/.' || $rel =~ \.\. ]]; then echo "$orig"; else echo "$rel"; fi
}

Expand Down

0 comments on commit 38cb886

Please sign in to comment.