Commit 6bdb402f authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

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: default avatarPetar Perisin <petar.perisin@gmail.com>
parent e2d25884
......@@ -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()) {
......
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