chore: shellcheck fixes

This commit is contained in:
Lorenz Leutgeb
2025-04-22 15:43:02 +02:00
parent ce07e92a2e
commit cbca3af260
14 changed files with 56 additions and 45 deletions
+6 -4
View File
@@ -24,7 +24,7 @@ done
# Current/latest tag.
current=$(git describe --tags --match='v*' --abbrev=0)
version=$(echo $current | sed 's/^v//')
version=$(echo "$current" | sed 's/^v//')
if [ -z "$from" ]; then
previous="$(git describe --abbrev=0 HEAD^)"
@@ -53,14 +53,16 @@ echo "* This update is recommended for everyone. No manual intervention is requi
echo
echo "## Changelog"
ncommits=$(git rev-list --count $previous..$current)
ncontribs=$(git log $previous..$current --format='%ae' | sort -u | wc -l)
range="${previous}..${current}"
ncommits=$(git rev-list --count "$range")
ncontribs=$(git log "$range" --format='%ae' | sort -u | wc -l)
echo
echo "This release contains $ncommits commit(s) by $ncontribs contributor(s)."
echo
git log --pretty=format:'* `%h` **%s** *<%ae>*' $previous..$current
# shellcheck disable=SC2016
git log --pretty=format:'* `%h` **%s** *<%ae>*' "$range"
echo
echo "## Checksums"
+2 -2
View File
@@ -5,8 +5,8 @@ DB="$(rad path)/node/node.db"
if command -v sqlite3 >/dev/null 2>&1; then
if [ -f "$DB" ]; then
echo -n "Clearing 'refs' table from $DB.. "
sqlite3 $DB "DELETE FROM refs;"
printf "Clearing 'refs' table from %s.. " "$DB"
sqlite3 "$DB" "DELETE FROM refs;"
echo "done."
else
echo "fatal: database file does not exist"
+3 -3
View File
@@ -6,12 +6,12 @@ unset SSH_AGENT_PID
tmp="$(mktemp -d)"
export RAD_HOME=$tmp/.radicle
export RAD_HOME="$tmp/.radicle"
export RAD_PASSPHRASE=
set -x
mkdir $tmp/acme
cd $tmp/acme
mkdir "$tmp/acme"
cd "$tmp/acme"
echo "ACME" > README
echo "Copyright (c) 1978-1986 ACME Corp." > COPY
+1 -1
View File
@@ -20,7 +20,7 @@ for branch in $(git branch -r --format "%(refname:short)"); do
# Extract the branch name without the "$remote/" prefix.
branch=${branch#"$remote/"}
# Never delete the master branch.
if [ "$branch" == "master" ]; then
if [ "$branch" = "master" ]; then
continue
fi
+2 -2
View File
@@ -16,14 +16,14 @@ if [ "$REMOTE" = "$(rad self --nid)" ]; then
exit 1
fi
cd $RAD_HOME/storage/$REPO
cd "$RAD_HOME/storage/$REPO"
refs=$(git for-each-ref --format="%(refname)")
pattern="refs/namespaces/$2/refs/*"
for ref in $refs; do
case "$ref" in
$pattern)
"$pattern" )
git update-ref -d "$ref"
printf 'Deleted %s\n' "$ref"
;;
+5 -2
View File
@@ -25,9 +25,12 @@ if ! command -v sed > /dev/null; then
fi
function removeImgTags {
local html="$(cat)"
local imgTags="$(echo "$html" | pcregrep -M '<img [^>]*>')"
local html
html="$(cat)"
local imgTags
imgTags="$(echo "$html" | pcregrep -M '<img [^>]*>')"
# shellcheck disable=SC2066
for imgTag in "$imgTags"; do
html="$(echo "$html" | sed -z "s@$imgTag@@")"
done
+2 -2
View File
@@ -6,7 +6,7 @@ if [ "$#" -lt 1 ]; then
exit 1
fi
rad patch checkout $1
rad patch checkout "$1"
git rebase master --autosquash
rad patch update $1 --message "Rebased on master"
rad patch update "$1" --message "Rebased on master"
git checkout master
+3 -1
View File
@@ -7,16 +7,18 @@ if [ "$#" -lt 2 ]; then
fi
RAD_HOME=${RAD_HOME:-"$HOME/.radicle"}
# shellcheck disable=SC2001
REPO=$(echo "$1" | sed 's/^rad://')
REMOTE=$2
cd $RAD_HOME/storage/$REPO
cd "$RAD_HOME/storage/$REPO"
sigrefs=$(git rev-parse "refs/namespaces/$REMOTE/refs/rad/sigrefs")
signed=$(git show "$sigrefs:refs")
actual=$(git for-each-ref "refs/namespaces/$REMOTE/refs/**" --format="%(objectname) %(refname)")
# Strip namespace prefix.
# shellcheck disable=SC2001
actual=$(echo "$actual" | sed "s@refs/namespaces/$REMOTE/@@")
# Remove `sigrefs` itself.
actual=$(echo "$actual" | grep -v "refs/rad/sigrefs$")