Skip to content

Commit 9dd8471

Browse files
authored
Merge pull request #53 from unixorn/clean-more-shellcheck-complaints
Clean more shellcheck complaints
2 parents 5e3629f + c24cdc2 commit 9dd8471

File tree

7 files changed

+13
-8
lines changed

7 files changed

+13
-8
lines changed

bin/git-rebase-authors

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77
set -e
88

9+
# shellcheck disable=SC2162,SC2034
910
while read action sha other; do
1011
if [ -n "$action" ]; then
1112
echo -n "$action "
12-
git show $sha --format="%h [%an] %s" -s
13+
git show "$sha" --format="%h [%an] %s" -s
1314
else
1415
echo
1516
fi

bin/git-rebase-work-in-progress

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
#
55
# Rebase commits that haven't been pushed to the tracked branch
66

7-
git rebase -i $(git rev-parse --abbrev-ref --symbolic-full-name @{u})
7+
# shellcheck disable=SC1083
8+
exec git rebase -i "$(git rev-parse --abbrev-ref --symbolic-full-name @{u})"

bin/git-recently-checkedout-branches

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ set -e
1313
seen=":"
1414
git_dir="$(git rev-parse --git-dir)"
1515

16+
# shellcheck disable=SC2162
1617
git reflog -n100 --pretty='%cr|%gs' --grep-reflog='checkout: moving' HEAD | \
1718
while read line; do
1819
date="${line%%|*}"

bin/git-rm-deleted-from-repo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
#
77
# Delete files from the repo that you've deleted with `rm` instead of `git rm`
88

9-
exec git rm $(git ls-files -d)
9+
exec git rm "$(git ls-files -d)"

bin/git-show-overwritten

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ abort() {
2929
while [ "$#" -gt 0 ]; do
3030
case "$1" in
3131
--color ) colorize=1 ;;
32-
--no-color ) colorize= ;;
32+
--no-color ) colorize='';;
3333
-h | --help )
3434
sed -ne '/^#/!q;s/.\{1,2\}//;1d;p' < "$0"
3535
exit 0
@@ -101,14 +101,16 @@ git diff "${base}...${head}" --diff-filter=DM --no-prefix -w -U0 | grep -v '^+'
101101
}
102102
END { print num_lines, name_length }
103103
' | sort -n | {
104+
# shellcheck disable=SC2162
104105
read num_lines name_length
105106
if [ "$num_lines" -eq 0 ]; then
106107
color 31 "Warning: " >&2
107108
echo "no changed/removed lines found in the $base...$head diff" >&2
108109
fi
109110

111+
# shellcheck disable=SC2162
110112
while IFS=$'\t' read time sha author msg; do
111-
date -r $time "+%Y-%m-%d" | tr -d $'\n'
113+
date -r "$time" "+%Y-%m-%d" | tr -d $'\n'
112114
printf ' '
113115
color 33 "${sha:0:7}"
114116
printf ' '

bin/git-switch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
#
88
# Source: https://github.com/Andrew565/dotfiles
99

10-
BRANCH=`git branch | grep "$1"`
11-
exec git checkout $BRANCH
10+
BRANCH=$(git branch | grep "$1")
11+
exec git checkout "$BRANCH"

bin/git-track

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
# `origin/$branch-name`.
55

66
branch=$(git rev-parse --abbrev-ref HEAD)
7-
git branch $branch --set-upstream-to origin/$branch
7+
exec git branch "$branch" --set-upstream-to "origin/$branch"

0 commit comments

Comments
 (0)