Make git-nav-upstream use the upstream branch name

The previous git-nav-upstream fix used the current branch name, and
stored the upstream move relative to that branch (in the reflog), e.g
nav-upstream from branch foo to origin/master would should foo@{u}.
This unfortunately breaks if the branch is then deleted, so now we
calculate the upstream branch before checking it out, by passing
"@{u}" rather than HEAD to rev-parse.

Change-Id: I14a2eb8493d63e8386e988fd68b8a3125f19ce2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1536070
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
changes/70/1536070/2
Leszek Swirski 7 years ago committed by Commit Bot
parent 51c0f388a1
commit e989bb2b45

@ -3,4 +3,4 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
git checkout "$(git rev-parse --abbrev-ref HEAD)@{u}"
git checkout "$(git rev-parse --abbrev-ref "@{u}")"

Loading…
Cancel
Save