diff --git a/Library/Homebrew/cmd/update-reset.sh b/Library/Homebrew/cmd/update-reset.sh index 2f10efb2210461f90c746b23caf0259396c30420..9cccaa35fb1d10a58cf91b20ae6f0c2df24bb290 100644 --- a/Library/Homebrew/cmd/update-reset.sh +++ b/Library/Homebrew/cmd/update-reset.sh @@ -35,16 +35,15 @@ homebrew-update-reset() { for DIR in "${REPOS[@]}" do [[ -d "$DIR/.git" ]] || continue - cd "$DIR" || continue ohai "Fetching $DIR..." - git fetch --force --tags origin - git remote set-head origin --auto >/dev/null + git -C "$DIR" fetch --force --tags origin + git -C "$DIR" remote set-head origin --auto >/dev/null echo ohai "Resetting $DIR..." - head="$(git symbolic-ref refs/remotes/origin/HEAD)" + head="$(git -C "$DIR" symbolic-ref refs/remotes/origin/HEAD)" head="${head#refs/remotes/origin/}" - git checkout --force -B "$head" origin/HEAD + git -C "$DIR" checkout --force -B "$head" origin/HEAD echo done }