Currently, the command will print following message twice when not called
in git repo.
```
fatal: not a git repository (or any parent up to mount point /google)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
```
Bug: 339231299
Change-Id: Iab05e037a81b7e15dcc011d78480cd9ace7c7e36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5544438
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
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>
Using just @{u} to navigate upstream breaks navigating back down when
the upstream reaches a non-local branch, e.g. origin/master. This is
because git branch walks the reflog for detached heads, and sees @{u}
instead of e.g. origin/master, and so tries to calculate HEAD@{u}
which fails. See also the message send to the git mailing list:
https://public-inbox.org/git/CAGRskv__Qe-F-grBtq5v-uhHE+BQAcAcOQtX-GKB+MNOrxs0hQ@mail.gmail.com/
This patch works around this by manually specifying the branch from
which we are calculating upstream, e.g. for branch foo we do
git checkout foo@{u} instead of just git checkout @{u}. This ensures
that the reflog has a valid entry (albeit still a relative one).
Change-Id: I339d4e4288a1e104b9d7d3d568c45b2b156f0689
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1534217
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
git-map: Show your local repo's history in a pseudo-graphical format from the command line.
git-map-branches: Show the topology of all of your branches, and their upstream relationships.
git-nav-upstream: Navigate (checkout) to the upstream branch of the current branch.
git-nav-downstream: Navigate (checkout) to a downstream branch of the current branch. If there's more than one downstream branch, then present a menu to select which one you want.
R=agable@chromium.org, hinoka@chromium.org, stip@chromium.org, szager@chromium.org
BUG=
Review URL: https://codereview.chromium.org/184113002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@256384 0039d316-1c4b-4281-b951-d872f2087c98