Source:
<code>private void updateBranch() throws MergeException { if (mergeTip != null && (branchTip == null || branchTip != mergeTip)) { if (GitRepositoryManager.REF_CONFIG.equals(branchUpdate.getName())) { try { ProjectConfig cfg = new ProjectConfig(destProject.getNameKey()); cfg.load(repo, mergeTip); } catch (Exception e) { throw new MergeException("Submit would store invalid" + " project configuration " + mergeTip.name() + " for " + destProject.getName(), e); } } try { final Ref destRef = repo.getRef(branchUpdate.getRef().getName()); if (destRef == null) { throw new MergeException("Destination branch \"" + branchUpdate.getRef().getName() + "\" does not exist"); } <START> branchUpdate.setExpectedOldObjectId(destRef.getObjectId()); <END> } catch (IOException e) { throw new MergeException( "Failed to check existence of destination branch", e); } branchUpdate.setForceUpdate(false); branchUpdate.setNewObjectId(mergeTip); branchUpdate.setRefLogMessage("merged", true); try { switch (branchUpdate.update(rw)) { case NEW: case FAST_FORWARD: if (branchUpdate.getResult() == RefUpdate.Result.FAST_FORWARD) { tagCache.updateFastForward(destBranch.getParentKey(), branchUpdate.getName(), branchUpdate.getOldObjectId(), mergeTip); } if (GitRepositoryManager.REF_CONFIG.equals(branchUpdate.getName())) { projectCache.evict(destProject); ProjectState ps = projectCache.get(destProject.getNameKey()); repoManager.setProjectDescription(destProject.getNameKey(), ps.getProject().getDescription()); } replication.scheduleUpdate(destBranch.getParentKey(), branchUpdate .getName()); Account account = null; final PatchSetApproval submitter = getSubmitter(mergeTip.patchsetId); if (submitter != null) { account = accountCache.get(submitter.getAccountId()).getAccount(); } hooks.doRefUpdatedHook(destBranch, branchUpdate, account); break; default: throw new IOException(branchUpdate.getResult().name()); } } catch (IOException e) { throw new MergeException("Cannot update " + branchUpdate.getName(), e); } } }</code><technical_language>This mergeTip read start of merge op, *not* is read end of merge op</technical_language>

Target:
private void updateBranch() throws MergeException { if (mergeTip != null && (branchTip == null || branchTip != mergeTip)) { if (GitRepositoryManager.REF_CONFIG.equals(branchUpdate.getName())) { try { ProjectConfig cfg = new ProjectConfig(destProject.getNameKey()); cfg.load(repo, mergeTip); } catch (Exception e) { throw new MergeException("Submit would store invalid" + " project configuration " + mergeTip.name() + " for " + destProject.getName(), e); } } try { final Ref destRef = repo.getRef(branchUpdate.getRef().getName()); if (destRef == null) { throw new MergeException("Destination branch \"" + branchUpdate.getRef().getName() + "\" does not exist"); } branchUpdate.setExpectedOldObjectId(destRef.getObjectId()); } catch (IOException e) { throw new MergeException( "Failed to check existence of destination branch", e); } branchUpdate.setForceUpdate(false); branchUpdate.setNewObjectId(mergeTip); branchUpdate.setRefLogMessage("merged", true); try { switch (branchUpdate.update(rw)) { case NEW: case FAST_FORWARD: if (branchUpdate.getResult() == RefUpdate.Result.FAST_FORWARD) { tagCache.updateFastForward(destBranch.getParentKey(), branchUpdate.getName(), branchUpdate.getOldObjectId(), mergeTip); } if (GitRepositoryManager.REF_CONFIG.equals(branchUpdate.getName())) { projectCache.evict(destProject); ProjectState ps = projectCache.get(destProject.getNameKey()); repoManager.setProjectDescription(destProject.getNameKey(), ps.getProject().getDescription()); } replication.scheduleUpdate(destBranch.getParentKey(), branchUpdate .getName()); Account account = null; final PatchSetApproval submitter = getSubmitter(db, mergeTip.patchsetId); if (submitter != null) { account = accountCache.get(submitter.getAccountId()).getAccount(); } hooks.doRefUpdatedHook(destBranch, branchUpdate, account); break; default: throw new IOException(branchUpdate.getResult().name()); } } catch (IOException e) { throw new MergeException("Cannot update " + branchUpdate.getName(), e); } } }