Merge pull request #11241 from GauthamGoli/update-reset-style-fixes
update-reset.sh: Fix `shellcheck` style errors
This commit is contained in:
commit
4af9a35f10
@ -10,40 +10,40 @@ homebrew-update-reset() {
|
||||
|
||||
for option in "$@"
|
||||
do
|
||||
case "$option" in
|
||||
case "${option}" in
|
||||
-\?|-h|--help|--usage) brew help update-reset; exit $? ;;
|
||||
--debug) HOMEBREW_DEBUG=1 ;;
|
||||
-*)
|
||||
[[ "$option" = *d* ]] && HOMEBREW_DEBUG=1
|
||||
[[ "${option}" = *d* ]] && HOMEBREW_DEBUG=1
|
||||
;;
|
||||
*)
|
||||
REPOS+=("$option")
|
||||
REPOS+=("${option}")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n "$HOMEBREW_DEBUG" ]]
|
||||
if [[ -n "${HOMEBREW_DEBUG}" ]]
|
||||
then
|
||||
set -x
|
||||
fi
|
||||
|
||||
if [[ -z "${REPOS[*]}" ]]
|
||||
then
|
||||
REPOS+=("$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/*)
|
||||
REPOS+=("${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*)
|
||||
fi
|
||||
|
||||
for DIR in "${REPOS[@]}"
|
||||
do
|
||||
[[ -d "$DIR/.git" ]] || continue
|
||||
ohai "Fetching $DIR..."
|
||||
git -C "$DIR" fetch --force --tags origin
|
||||
git -C "$DIR" remote set-head origin --auto >/dev/null
|
||||
[[ -d "${DIR}/.git" ]] || continue
|
||||
ohai "Fetching ${DIR}..."
|
||||
git -C "${DIR}" fetch --force --tags origin
|
||||
git -C "${DIR}" remote set-head origin --auto >/dev/null
|
||||
echo
|
||||
|
||||
ohai "Resetting $DIR..."
|
||||
head="$(git -C "$DIR" symbolic-ref refs/remotes/origin/HEAD)"
|
||||
ohai "Resetting ${DIR}..."
|
||||
head="$(git -C "${DIR}" symbolic-ref refs/remotes/origin/HEAD)"
|
||||
head="${head#refs/remotes/origin/}"
|
||||
git -C "$DIR" checkout --force -B "$head" origin/HEAD
|
||||
git -C "${DIR}" checkout --force -B "${head}" origin/HEAD
|
||||
echo
|
||||
done
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user