Git: Preserve multiple branches that link to the same commit

If remote HEAD commit is referenced by multiple branches, only the last
one is currently listed

Change-Id: Iac689125610aaf49c0bc31285a0d283fd48a271c
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-02-14 09:54:16 +02:00
committed by Orgad Shaneh
parent 5c653f40a3
commit 0e86785019

View File

@@ -1673,10 +1673,12 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
const QString pattern = QLatin1String("\trefs/heads/"); const QString pattern = QLatin1String("\trefs/heads/");
const int pos = line.lastIndexOf(pattern); const int pos = line.lastIndexOf(pattern);
bool headFound = false;
if (pos != -1) { if (pos != -1) {
const QString branchName = line.mid(pos + pattern.count()); const QString branchName = line.mid(pos + pattern.count());
if (line.startsWith(headSha)) { if (!headFound && line.startsWith(headSha)) {
branches[0] = branchName; branches[0] = branchName;
headFound = true;
if (isDetached) if (isDetached)
*isDetached = false; *isDetached = false;
} else { } else {