Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update-reset.sh: Fix shellcheck style errors #11241

Merged
merged 1 commit into from
Apr 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 12 additions & 12 deletions Library/Homebrew/cmd/update-reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}