Commit 43e76f09 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Sort branches by commiterdate

parent 0441b0c8
......@@ -45,6 +45,9 @@ public:
protected:
bool lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const override
{
if (m_pattern.isEmpty()) {
return QSortFilterProxyModel::lessThan(sourceLeft, sourceRight);
}
const int l = sourceLeft.data(WeightRole).toInt();
const int r = sourceRight.data(WeightRole).toInt();
return l < r;
......
......@@ -41,7 +41,7 @@ QVector<GitUtils::Branch> GitUtils::getAllBranchesAndTags(const QString &repo, R
// git for-each-ref --format '%(refname) %(objectname) %(*objectname)'
QProcess git;
git.setWorkingDirectory(repo);
QStringList args{QStringLiteral("for-each-ref"), QStringLiteral("--format"), QStringLiteral("%(refname)")};
QStringList args{QStringLiteral("for-each-ref"), QStringLiteral("--format"), QStringLiteral("%(refname)"), QStringLiteral("--sort=-committerdate")};
git.start(QStringLiteral("git"), args);
QVector<Branch> branches;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment