Skip to content

Commit

Permalink
Ensure using "-literal around string variable
Browse files Browse the repository at this point in the history
  • Loading branch information
aho-dips committed Feb 12, 2024
1 parent 880179d commit e825895
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 158 deletions.
12 changes: 6 additions & 6 deletions smud-cli/download-and-install-cli.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
HOME_DIR=$(dirname `readlink -f ~/.bashrc`)
HOME_DIR="$(dirname `readlink -f ~/.bashrc`)"
VERSION="LATEST"
folder=smud-cli
curr_dir=$(pwd)
destination_folder=$HOME_DIR/$folder
download_folder=$HOME_DIR/$folder-downloaded
download_json_file=$download_folder/downloaded-info.json
curr_dir="$(pwd)"
destination_folder="$HOME_DIR/$folder"
download_folder="$HOME_DIR/$folder-downloaded"
download_json_file="$download_folder/downloaded-info.json"
if [ -d "$download_folder" ];then
rm -rf $download_folder
fi
Expand Down Expand Up @@ -61,7 +61,7 @@ for url in "${download_urls[@]}"; do
if [ ! "$file" ]; then
file="$(echo "$url"|sed -e 's/.*\/main\/smud-cli\/\(.*\)/\1/g')"
fi
downloaded_file=$(basename $url)
downloaded_file="$(basename $url)"
if [ "$file" ]; then
printf "${gray}Download '$file' file: ${normal}\n"
# echo "Download:$url => $file"
Expand Down
6 changes: 3 additions & 3 deletions smud-cli/functions-gitops.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ gitops_model__show_changelog_file()
{
from="$1"
if [ "$from" = "git" ]; then
revisions=$git_range
revisions="$git_range"
if [ ! "$revisions" ]; then
echo "No revisions available to fetch GitOps-model Changelog!"
return
Expand All @@ -78,8 +78,8 @@ gitops_model__show_changelog_file()
}
else
local context="Current"
BASEDIR=$(dirname "$0")
file=$BASEDIR/CHANGELOG.md
BASEDIR="$(dirname "$0")"
file="$BASEDIR/CHANGELOG.md"
if [ -f $file ]; then
show_changelog_command="cat $file"
fi
Expand Down
18 changes: 9 additions & 9 deletions smud-cli/functions-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ set_upstream()
print_not_silent "${gray}Upstream configured with '$new_upstream' ${normal}\n"
fi
elif [ ! "$new_upstream" ]; then
new_upstream=$default_upstream
new_upstream="$default_upstream"
add_upstream_command="git remote add upstream $new_upstream"
run_command add_upstream_command --command-from-var=add_upstream_command --debug-title='Adding upstream with default URL'
print_not_silent "${gray}Upstream configured with '$new_upstream' ${normal}\n"
Expand Down Expand Up @@ -96,7 +96,7 @@ init_repo()
run_command init-repo --command-from-var=init_command --return-var=dummy --debug-title='Initializing repository' || return
is_repo="true"

branches=$(git branch)
branches="$(git branch)"
if [ ! -n "$branches" ]; then
# "main" possibly not default branch name so create it
create_main_branch="git checkout -b main"
Expand All @@ -114,7 +114,7 @@ fetch_upstream()
init()
{
if [ "$help" ]; then
func=${1:-init}
func="${1:-init}"
echo "${bold}smud $func${normal}: Initializes local repository and sets upstream, origin remotes and source-branch"
printf "Upstream: \n"
printf " With Only ${green}$func${normal}, Upstream '$default_upstream' will be configured if not configured yet. When configured the upstream will be fetched. \n"
Expand All @@ -136,8 +136,8 @@ init()
upstream_url="$first_param"
fi
fi
remote_origin=$(git config --get remote.origin.url)
remote_upstream=$(git config --get remote.upstream.url)
remote_origin="$(git config --get remote.origin.url)"
remote_upstream="$(git config --get remote.upstream.url)"

if [ ! "$remote_upstream" ] || [ "$upstream_url" ]; then
if [ ! "$upstream_url" ]; then
Expand Down Expand Up @@ -166,18 +166,18 @@ init()

if [ "$is_repo" ]; then
if [ ! "$source_branch" ]; then
source_branch=$(git config --get source.$current_branch)
source_branch="$(git config --get source.$current_branch)"
fi
if [ ! "$source_branch" ]; then
source_branch="upstream/$default_branch"
fi

old=$(git config --get source.$current_branch)
old="$(git config --get source.$current_branch)"
if [ ! "$old" = "$source_branch" ] || [ ! "$old" ] ; then
if [ "$old" ]; then
dummy=$(git config --unset source.$current_branch)
dummy="$(git config --unset source.$current_branch)"
fi
dummy=$(git config --add source.$current_branch $source_branch)
dummy="$(git config --add source.$current_branch $source_branch)"
fi
fi

Expand Down
Loading

0 comments on commit e825895

Please sign in to comment.