Commit 0bbd1c28 authored by Aaron Gable's avatar Aaron Gable Committed by Commit Bot

git-cl: upload to merge-base with master, not tip of origin/master

Previously, if the branch structure was
origin/master
  master [ 3 commits behind origin/master ]
    my-branch [ 1 commit ahead of master ]
then git-cl would see that the upstream branch is master,
and decide to diff against origin/master instead. But that
diff would contain the contents of the three commits that
the local master branch hasn't caught up with yet. That's
not what we want.

This CL makes it so that basing on top of local master is
the same as basing on top of remote branches. Just like
when based on top of origin/master, it simply calculates
the merge-base with the parent commit (which is assumed
to be present in the remote), and uploads that diff.

Change-Id: I91caa30f6256a6e019e613dc5ff624734bca027e
Reviewed-on: https://chromium-review.googlesource.com/499307Reviewed-by: 's avatarRobbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
parent 14f825d5
......@@ -3061,7 +3061,7 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
upstream_branch_name = scm.GIT.ShortBranchName(upstream_branch)
if upstream_branch_name == 'master':
return 'origin/master'
return self.GetCommonAncestorWithUpstream()
# Check the squashed hash of the parent.
# TODO(tandrii): consider checking parent change in Gerrit and using its
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment