Fix brew update user agent.

This needs to be `Homebrew $HOMEBREW_VERSION` so we can be adequately
filtered.

Closes Homebrew/homebrew#49961.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Mike McQuaid 2016-03-10 13:41:02 +00:00 committed by Xu Cheng
parent c8debd8fa4
commit 2c3a7e8c75
3 changed files with 7 additions and 3 deletions

View File

@ -342,8 +342,9 @@ EOS
# (so the API does not return 304: unmodified). # (so the API does not return 304: unmodified).
UPSTREAM_SHA_HTTP_CODE="$(curl --silent '--max-time' 3 \ UPSTREAM_SHA_HTTP_CODE="$(curl --silent '--max-time' 3 \
--output /dev/null --write-out "%{http_code}" \ --output /dev/null --write-out "%{http_code}" \
-H "Accept: application/vnd.github.chitauri-preview+sha" \ --user-agent "Homebrew $HOMEBREW_VERSION" \
-H "If-None-Match: \"$UPSTREAM_BRANCH_LOCAL_SHA\"" \ --header "Accept: application/vnd.github.chitauri-preview+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")"
[[ "$UPSTREAM_SHA_HTTP_CODE" = "304" ]] && exit [[ "$UPSTREAM_SHA_HTTP_CODE" = "304" ]] && exit
fi fi

View File

@ -12,7 +12,7 @@ require "rbconfig"
ARGV.extend(HomebrewArgvExtension) ARGV.extend(HomebrewArgvExtension)
HOMEBREW_VERSION = "0.9.5" HOMEBREW_VERSION = ENV["HOMEBREW_VERSION"]
HOMEBREW_WWW = "http://brew.sh" HOMEBREW_WWW = "http://brew.sh"
require "config" require "config"

View File

@ -1,3 +1,5 @@
HOMEBREW_VERSION="0.9.5"
odie() { odie() {
if [[ -t 2 ]] # check whether stderr is a tty. if [[ -t 2 ]] # check whether stderr is a tty.
then then
@ -70,6 +72,7 @@ then
fi fi
fi fi
export HOMEBREW_VERSION
export HOMEBREW_BREW_FILE export HOMEBREW_BREW_FILE
export HOMEBREW_RUBY_PATH export HOMEBREW_RUBY_PATH
export HOMEBREW_PREFIX export HOMEBREW_PREFIX