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

avoid Github API rate limit #242

Merged
merged 1 commit into from
Mar 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions git-extra/git-update-git-for-windows
Original file line number Diff line number Diff line change
Expand Up @@ -162,25 +162,23 @@ update_git_for_windows () {
;;
esac

releases_url=https://api.github.com/repos/git-for-windows/git/releases
releases=$(http_get $releases_url/latest) ||
latest_tag_url=https://gitforwindows.org/latest-tag.txt
latest_tag=$(http_get $latest_tag_url) ||
case $?,"$proxy" in
7,)
proxy="$(proxy-lookup.exe https://api.github.com)" &&
proxy="$(proxy-lookup.exe https://gitforwindows.org)" &&
test -n "$proxy" &&
export https_proxy="$proxy" &&
echo "Using proxy $https_proxy as per lookup" >&2 &&
releases=$(http_get $releases_url/latest) ||
latest_tag=$(http_get $latest_tag_url) ||
return
;;
*)
return
;;
esac

latest=$(echo "$releases" |
grep '"tag_name": "v' |
sed -E 's/.*"tag_name": "v([^"]*).*/\1/')
latest=${latest_tag#v}
# Did we ask about this version already?
recently_seen="$(git config --global winUpdater.recentlySeenVersion)"
test -n "$quiet" && test "x$recently_seen" = "x$latest" && return
Expand All @@ -205,6 +203,8 @@ update_git_for_windows () {
esac

echo "Update $latest is available" >&2
releases_url=https://api.github.com/repos/git-for-windows/git/releases
releases=$(http_get $releases_url/latest) || return
download=$(echo "$releases" |
grep '"browser_download_url": "' |
grep "$bit\-bit\.exe" |
Expand Down