Skip to content

Commit da034f3

Browse files
committed
Update
1 parent 6199cc9 commit da034f3

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

technology/git/git-tools.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
# Settings
1616
git_hostname="github.com"
17-
git_account=$(git config user.name) # Username or Organization
17+
git_account="$(git config user.name)" # Username or Organization
1818
git_repository="tools"
1919
git_branch="main"
20-
local_repository=$git_repository
20+
local_repository="$git_repository"
2121

2222

2323
# Set working directory
@@ -30,11 +30,11 @@ fi
3030

3131
# Clone repository if directory does not exist
3232
if [ ! -d "${local_repository}" ]; then
33-
git clone --branch "${git_branch}" "https://${git_hostname}/${git_account}/${git_repository}.git" ${local_repository}
33+
git clone --branch "${git_branch}" "https://${git_hostname}/${git_account}/${git_repository}.git" "${local_repository}"
3434
fi
3535

3636
# Set working directory
37-
cd $local_repository
37+
cd "$local_repository"
3838

3939

4040
# Download .pre-commit-config.yaml file
@@ -58,7 +58,7 @@ prettier --write --print-width 220 --prose-wrap never --semi true --single-quote
5858
find . -type f -name "*.php" | grep -q . && php-cs-fixer fix . --rules=@PSR12 --using-cache=no --no-interaction
5959

6060
## XML
61-
find . -type f -name "*.xml" | grep -q . && find . -name "*.xml" -exec xmllint --format {} --output {} \;
61+
find . -type f -name "*.xml" -exec xmllint --format --output {} {} \;
6262

6363
## codespell
6464
codespell . --ignore-words-list=alle,als,bootup,datas,deine,dokument,doubleclick,fo,ges,ist,itens,nax,oder,produkt,referers,ressource,ser,sie,tage,termine # The --ignore-words-list argument has a bug where it needs to be lowercase, see: https://github.com/codespell-project/codespell/issues/1390
@@ -121,15 +121,15 @@ git commit --all --message="Update"
121121
git remote set-url origin "https://${git_hostname}/${git_account}/${git_repository}.git"
122122

123123
# Write commits to remote repository
124-
git push --force origin ${git_branch}
124+
git push --force origin "${git_branch}"
125125

126126

127127

128128

129129
## Squash commit history - https://stackoverflow.com/a/56878987/9195104
130130

131131
# Count of commits
132-
git rev-list --count HEAD ${git_branch}
132+
git rev-list --count HEAD "${git_branch}"
133133

134134

135135
# Create a temporary file to store commits to keep
@@ -162,8 +162,8 @@ rm --force $TOKEEP
162162

163163

164164
# Repository force update
165-
git push --force origin ${git_branch}
165+
git push --force origin "${git_branch}"
166166

167167

168168
# New count of commits
169-
git rev-list --count HEAD ${git_branch}
169+
git rev-list --count HEAD "${git_branch}"

0 commit comments

Comments
 (0)