Git: Prefer first match on Push to Gerrit with detached head

Following matches are likely to be merges, and not the branch that the
first commit originated from.

Change-Id: I80a442bf9f7bc7f5859a1f4c3d3e167d55b28241
Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
This commit is contained in:
Orgad Shaneh
2013-11-05 09:08:12 +02:00
committed by Orgad Shaneh
parent e2d258842e
commit 6bdb402f31

View File

@@ -80,11 +80,14 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
if (ref.contains(head) || ref.isEmpty())
continue;
remoteBranch = ref;
if (remoteBranch.isEmpty())
remoteBranch = ref;
// Prefer remote tracking branch if it exists and contains the latest remote commit
if (ref == remoteTrackingBranch)
if (ref == remoteTrackingBranch) {
remoteBranch = ref;
break;
}
}
if (!remoteBranch.isEmpty()) {