Prevent Uncommitted Changes from being shown when ShowCleanStatus is false

Merge pull request #714 from jensenr30/fix-show-clean-status
This commit is contained in:
Murmele 2024-05-22 10:07:51 +02:00 committed by GitHub
commit 04991eb1df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -186,8 +186,8 @@ public:
// Update status row.
bool head = (!mRef.isValid() || mRef.isHead());
bool valid = (mCleanStatus || !mStatus.isFinished() || status().isValid());
if (head && valid && mPathspec.isEmpty()) {
bool valid = (!mStatus.isFinished() || status().isValid());
if (mShowCleanStatus && head && valid && mPathspec.isEmpty()) {
QVector<Column> row;
if (mGraphVisible && mRef.isValid() && mStatus.isFinished()) {
row.append({Segment(Bottom, kTaintedColor), Segment(Dot, QColor())});
@ -239,7 +239,7 @@ public:
git::Config config = mRepo.appConfig();
mRefsAll = config.value<bool>("commit.refs.all", true);
mSortDate = config.value<bool>("commit.sort.date", true);
mCleanStatus = config.value<bool>("commit.status.clean", false);
mShowCleanStatus = config.value<bool>("commit.show.status", true);
mGraphVisible = config.value<bool>("commit.graph.visible", true);
if (walk)
@ -559,7 +559,7 @@ private:
bool mSuppressResetWalker{false};
bool mRefsAll = true;
bool mSortDate = true;
bool mCleanStatus = true;
bool mShowCleanStatus = true;
bool mGraphVisible = true;
};

View File

@ -25,7 +25,7 @@ namespace {
const QString kRefsKey = "commit.refs.all";
const QString kSortKey = "commit.sort.date";
const QString kGraphKey = "commit.graph.visible";
const QString kStatusKey = "commit.status.clean";
const QString kStatusKey = "commit.show.status";
const QString kStyleSheet = "QToolBar {"
" border: none"
"}"
@ -155,7 +155,7 @@ CommitToolBar::CommitToolBar(QWidget *parent) : QToolBar(parent) {
QAction *status = menu->addAction(tr("Show Clean Status"));
status->setCheckable(true);
status->setChecked(config.value<bool>(kStatusKey, false));
status->setChecked(config.value<bool>(kStatusKey, true));
connect(status, &QAction::triggered, [this](bool checked) {
RepoView *view = RepoView::parentView(this);
view->repo().appConfig().setValue(kStatusKey, checked);