Skip to content
Snippets Groups Projects
Unverified Commit aeafbd1c authored by Shaun Jackman's avatar Shaun Jackman Committed by GitHub
Browse files

Merge pull request #7758 from sjackman/origin-head

update: Fetch the symbolic reference origin/HEAD
parents 11adee55 b5584fc0
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,7 @@ homebrew-update-reset() {
cd "$DIR" || continue
ohai "Fetching $DIR..."
git fetch --force --tags origin
git remote set-head origin --auto >/dev/null
echo
ohai "Resetting $DIR..."
......
......@@ -38,6 +38,7 @@ git_init_if_necessary() {
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
latest_tag="$(git ls-remote --tags --refs -q origin | tail -n1 | cut -f2)"
git fetch --force origin --shallow-since="$latest_tag"
git remote set-head origin --auto >/dev/null
git reset --hard origin/master
SKIP_FETCH_BREW_REPOSITORY=1
set +e
......@@ -59,6 +60,7 @@ git_init_if_necessary() {
git config remote.origin.url "$HOMEBREW_CORE_GIT_REMOTE"
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch --force --depth=1 origin refs/heads/master:refs/remotes/origin/master
git remote set-head origin --auto >/dev/null
git reset --hard origin/master
SKIP_FETCH_CORE_REPOSITORY=1
set +e
......@@ -84,6 +86,11 @@ upstream_branch() {
local upstream_branch
upstream_branch="$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null)"
if [[ -z "$upstream_branch" ]]
then
git remote set-head origin --auto >/dev/null
upstream_branch="$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null)"
fi
upstream_branch="${upstream_branch#refs/remotes/origin/}"
[[ -z "$upstream_branch" ]] && upstream_branch="master"
echo "$upstream_branch"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment