From 8cd11e93e0b113037fafbd565cd8dea5a13d3c8f Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 12 Feb 2023 14:40:16 +0200 Subject: [PATCH] Git: Filter out tags on command execution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For a repo with ~50K tags, this reduces the time of for-each-ref from ~1s to ~270ms. Change-Id: I00f735bba62307cc9419619ebe5aa71a800368ea Reviewed-by: Qt CI Bot Reviewed-by: Reviewed-by: André Hartmann --- src/plugins/git/branchmodel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp index dbfbf4bfe84..3c4971fa734 100644 --- a/src/plugins/git/branchmodel.cpp +++ b/src/plugins/git/branchmodel.cpp @@ -409,8 +409,12 @@ bool BranchModel::refresh(const FilePath &workingDirectory, QString *errorMessag } d->currentSha = d->client->synchronousTopRevision(workingDirectory, &d->currentDateTime); - const QStringList args = {"--format=%(objectname)\t%(refname)\t%(upstream:short)\t" - "%(*objectname)\t%(committerdate:raw)\t%(*committerdate:raw)"}; + QStringList args = {"--format=%(objectname)\t%(refname)\t%(upstream:short)\t" + "%(*objectname)\t%(committerdate:raw)\t%(*committerdate:raw)", + "refs/heads/**", + "refs/remotes/**"}; + if (d->client->settings().showTags.value()) + args << "refs/tags/**"; QString output; if (!d->client->synchronousForEachRefCmd(workingDirectory, args, &output, errorMessage)) { endResetModel();