diff options
| author | Mike McQuaid | 2016-08-12 10:24:39 +0100 |
|---|---|---|
| committer | GitHub | 2016-08-12 10:24:39 +0100 |
| commit | 58ffe34bc95f5066cfa3ea7aabe8ef1a2b8fbdf9 (patch) | |
| tree | d1fc0a541e089b2cc9be9457144241bfe01d4a7b | |
| parent | 97a66aa513f515472b3c36256f4624060d5e365c (diff) | |
| parent | 99837fae4746db48b656da197c4f9d179d38321c (diff) | |
| download | brew-58ffe34bc95f5066cfa3ea7aabe8ef1a2b8fbdf9.tar.bz2 | |
Merge pull request #699 from MikeMcQuaid/update-upstream-branch
update.sh: prevent overwriting UPSTREAM_BRANCH.
| -rw-r--r-- | Library/Homebrew/cmd/update.sh | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 8078578a3..68eae6c2c 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -389,9 +389,9 @@ EOS fi TAP_VAR="$(repo_var "$DIR")" - UPSTREAM_BRANCH="$(upstream_branch)" - declare UPSTREAM_BRANCH"$TAP_VAR"="$UPSTREAM_BRANCH" - declare PREFETCH_REVISION"$TAP_VAR"="$(git rev-parse -q --verify refs/remotes/origin/"$UPSTREAM_BRANCH")" + UPSTREAM_BRANCH_DIR="$(upstream_branch)" + declare UPSTREAM_BRANCH"$TAP_VAR"="$UPSTREAM_BRANCH_DIR" + declare PREFETCH_REVISION"$TAP_VAR"="$(git rev-parse -q --verify refs/remotes/origin/"$UPSTREAM_BRANCH_DIR")" [[ -n "$SKIP_FETCH_BREW_REPOSITORY" && "$DIR" = "$HOMEBREW_REPOSITORY" ]] && continue [[ -n "$SKIP_FETCH_CORE_REPOSITORY" && "$DIR" = "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && continue @@ -420,7 +420,7 @@ EOS then UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY_URL#https://github.com/}" UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY%.git}" - UPSTREAM_BRANCH_LOCAL_SHA="$(git rev-parse "refs/remotes/origin/$UPSTREAM_BRANCH")" + UPSTREAM_BRANCH_LOCAL_SHA="$(git rev-parse "refs/remotes/origin/$UPSTREAM_BRANCH_DIR")" # Only try to `git fetch` when the upstream branch is at a different SHA # (so the API does not return 304: unmodified). UPSTREAM_SHA_HTTP_CODE="$("$HOMEBREW_CURL" --silent --max-time 3 \ @@ -428,7 +428,7 @@ EOS --user-agent "$HOMEBREW_USER_AGENT_CURL" \ --header "Accept: application/vnd.github.v3.sha" \ --header "If-None-Match: \"$UPSTREAM_BRANCH_LOCAL_SHA\"" \ - "https://api.github.com/repos/$UPSTREAM_REPOSITORY/commits/$UPSTREAM_BRANCH")" + "https://api.github.com/repos/$UPSTREAM_REPOSITORY/commits/$UPSTREAM_BRANCH_DIR")" # Touch FETCH_HEAD to confirm we've checked for an update. [[ -f "$DIR/.git/FETCH_HEAD" ]] && touch "$DIR/.git/FETCH_HEAD" [[ "$UPSTREAM_SHA_HTTP_CODE" = "304" ]] && exit @@ -446,10 +446,10 @@ EOS if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]] then git fetch --force "${QUIET_ARGS[@]}" origin \ - "refs/heads/$UPSTREAM_BRANCH:refs/remotes/origin/$UPSTREAM_BRANCH" 2>/dev/null + "refs/heads/$UPSTREAM_BRANCH_DIR:refs/remotes/origin/$UPSTREAM_BRANCH_DIR" 2>/dev/null else if ! git fetch --force "${QUIET_ARGS[@]}" origin \ - "refs/heads/$UPSTREAM_BRANCH:refs/remotes/origin/$UPSTREAM_BRANCH" + "refs/heads/$UPSTREAM_BRANCH_DIR:refs/remotes/origin/$UPSTREAM_BRANCH_DIR" then echo "Fetching $DIR failed!" >>"$update_failed_file" fi |
