diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp index 14a59f0993b..ed80feeb16a 100644 --- a/src/plugins/git/branchmodel.cpp +++ b/src/plugins/git/branchmodel.cpp @@ -318,9 +318,12 @@ QVariant BranchModel::data(const QModelIndex &index, int role) const if (!node->isLocal() || !node->isLeaf()) break; - res += ' ' + arrowUp + QString::number(node->status.ahead); + if (node->status.ahead >= 0) + res += ' ' + arrowUp + QString::number(node->status.ahead); + if (!node->tracking.isEmpty()) { - res += ' ' + arrowDown + QString::number(node->status.behind); + if (node->status.behind >= 0) + res += ' ' + arrowDown + QString::number(node->status.behind); res += " [" + node->tracking + ']'; } break; diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 3f8368c62eb..f0ed9ffc8eb 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -73,8 +73,8 @@ public: UpstreamStatus() = default; UpstreamStatus(int ahead, int behind) : ahead(ahead), behind(behind) {} - int ahead = 0; - int behind = 0; + int ahead = -1; + int behind = -1; }; struct Author {