Git: Disable upstream status for Detached HEAD

It was always zero as Detached HEAD is a special
branch that is not actively queried. It can be
enabled later, but the quick fix is to disable it.

Change-Id: Ib191e1b5551a13bc4911184e12e06a0b4dc28ddf
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Andre Hartmann
2024-02-11 12:34:02 +01:00
committed by André Hartmann
parent d9eeddfad1
commit c22471d316
2 changed files with 7 additions and 4 deletions

View File

@@ -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;

View File

@@ -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 {