From 0e867850194414b82080e36a968abf54e68363ee Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 14 Feb 2013 09:54:16 +0200 Subject: [PATCH] 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 --- src/plugins/git/gitclient.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index af3d15264af..eb1238a0ffa 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1673,10 +1673,12 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR const QString pattern = QLatin1String("\trefs/heads/"); const int pos = line.lastIndexOf(pattern); + bool headFound = false; if (pos != -1) { const QString branchName = line.mid(pos + pattern.count()); - if (line.startsWith(headSha)) { + if (!headFound && line.startsWith(headSha)) { branches[0] = branchName; + headFound = true; if (isDetached) *isDetached = false; } else {