Skip to content

Commit

Permalink
Merge pull request #11241 from GauthamGoli/update-reset-style-fixes
Browse files Browse the repository at this point in the history
update-reset.sh: Fix `shellcheck` style errors
  • Loading branch information
MikeMcQuaid committed Apr 26, 2021
2 parents 7135cc0 + a9236a3 commit 4af9a35
Showing 1 changed file with 12 additions and 12 deletions.
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
}

0 comments on commit 4af9a35

Please sign in to comment.