mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
sync: try to fast forward merge branches before checking published state
If the local branch changed state since its last upload, the data cached in .git/config related to the last uploaded CL might not be that relevant. If we're able to fast forward merge to the latest tree state, then let's do that. This would be akin to checking out a detached head before syncing where we already switch state. If we aren't able to fast forward merge, then it's not a big deal as we'll continue on to the existing branch checking logic. This would be easy to reproduce by doing something like: $ repo start foo . $ git revert HEAD $ repo upload --cbr . $ git reset --hard HEAD^ <CL is merged> $ repo sync . <we can fast forward> Change-Id: I7d62f3d1ba5314a349d85b4dbb0ec8352eca18bb Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/238552 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Michael Mortensen <mmortensen@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
3538dd224d
commit
2ba5a1e963
@ -1586,7 +1586,16 @@ class Project(object):
|
||||
return
|
||||
|
||||
upstream_gain = self._revlist(not_rev(HEAD), revid)
|
||||
|
||||
# See if we can perform a fast forward merge. This can happen if our
|
||||
# branch isn't in the exact same state as we last published.
|
||||
try:
|
||||
self.work_git.merge_base('--is-ancestor', HEAD, revid)
|
||||
# Skip the published logic.
|
||||
pub = False
|
||||
except GitError:
|
||||
pub = self.WasPublished(branch.name, all_refs)
|
||||
|
||||
if pub:
|
||||
not_merged = self._revlist(not_rev(revid), pub)
|
||||
if not_merged:
|
||||
|
Loading…
Reference in New Issue
Block a user