@@ -150,6 +150,17 @@ class CommitModel : public QAbstractListModel {
150
150
resetWalker ();
151
151
}
152
152
153
+ bool is_working_tree_clean (void ) const {
154
+ if (mStatus .isRunning ()) {
155
+ return false ;
156
+ }
157
+ git::Diff stat = status ();
158
+ if (!stat.isValid ()) {
159
+ return true ;
160
+ }
161
+ return stat.count () == 0 ;
162
+ }
163
+
153
164
void suppressResetWalker (bool suppress) { mSuppressResetWalker = suppress; }
154
165
155
166
bool isResetWalkerSuppressed () { return mSuppressResetWalker ; }
@@ -186,8 +197,8 @@ class CommitModel : public QAbstractListModel {
186
197
187
198
// Update status row.
188
199
bool head = (!mRef .isValid () || mRef .isHead ());
189
- bool valid = (! mStatus .isFinished () || status (). isValid ());
190
- if ( mShowCleanStatus && head && valid && mPathspec .isEmpty ()) {
200
+ if ( mShowCleanStatus && head && mStatus .isFinished () &&
201
+ mPathspec .isEmpty ()) {
191
202
QVector<Column> row;
192
203
if (mGraphVisible && mRef .isValid () && mStatus .isFinished ()) {
193
204
row.append ({Segment (Bottom, kTaintedColor ), Segment (Dot, QColor ())});
@@ -322,17 +333,19 @@ class CommitModel : public QAbstractListModel {
322
333
323
334
QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const {
324
335
const Row &row = mRows .at (index .row ());
325
- bool status = !row.commit .isValid ();
336
+ bool commit_is_valid = row.commit .isValid ();
337
+
326
338
switch (role) {
327
339
case Qt::DisplayRole:
328
- if (!status )
340
+ if (commit_is_valid )
329
341
return QVariant ();
330
-
331
- return mStatus .isFinished () ? tr (" Uncommitted changes" )
332
- : tr (" Checking for uncommitted changes" );
342
+ if (!mStatus .isFinished ())
343
+ return tr (" Checking for uncommitted changes" );
344
+ return is_working_tree_clean () ? tr (" Working tree clean" )
345
+ : tr (" Uncommitted changes" );
333
346
334
347
case Qt::FontRole: {
335
- if (!status )
348
+ if (commit_is_valid )
336
349
return QVariant ();
337
350
338
351
QFont font = static_cast <QWidget *>(QObject::parent ())->font ();
@@ -341,19 +354,19 @@ class CommitModel : public QAbstractListModel {
341
354
}
342
355
343
356
case Qt::TextAlignmentRole:
344
- if (!status )
357
+ if (commit_is_valid )
345
358
return QVariant ();
346
359
347
360
return QVariant (Qt::AlignHCenter | Qt::AlignVCenter);
348
361
349
362
case Qt::DecorationRole:
350
- if (!status )
363
+ if (commit_is_valid )
351
364
return QVariant ();
352
365
353
366
return mStatus .isFinished () ? QVariant () : mProgress ;
354
367
355
368
case CommitList::Role::DiffRole: {
356
- if (status )
369
+ if (!commit_is_valid )
357
370
return QVariant::fromValue (this ->status ());
358
371
359
372
bool ignoreWhitespace = Settings::instance ()->isWhitespaceIgnored ();
@@ -363,7 +376,7 @@ class CommitModel : public QAbstractListModel {
363
376
}
364
377
365
378
case CommitList::Role::CommitRole:
366
- return status ? QVariant () : QVariant:: fromValue (row.commit );
379
+ return commit_is_valid ? QVariant:: fromValue (row.commit ) : QVariant ( );
367
380
368
381
case CommitList::Role::GraphRole: {
369
382
QVariantList columns;
0 commit comments