Commit 47b01acd authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Git: Some cleanup for branches on show

* Suppress command logging
* If no branches are found, do not add "Branches:" line

Change-Id: Id32b5f429a5c0324ec9e6d9d016f47160e9e5012
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 35fce3c2
......@@ -1804,11 +1804,14 @@ void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const
QStringList GitClient::synchronousBranchesForCommit(const QString &workingDirectory, const QString &revision)
{
QByteArray outputData;
QString output;
QStringList arguments;
arguments << QLatin1String(noColorOption) << QLatin1String("-a")
<< QLatin1String("--contains") << revision;
synchronousBranchCmd(workingDirectory, arguments, &output, 0);
arguments << QLatin1String("branch") << QLatin1String(noColorOption)
<< QLatin1String("-a") << QLatin1String("--contains") << revision;
fullySynchronousGit(workingDirectory, arguments, &outputData, 0,
VcsBasePlugin::SuppressCommandLogging);
output = commandOutputFromLocal8Bit(outputData);
QStringList res;
foreach (const QString &branch, output.split(QLatin1Char('\n'))) {
const QString b = branch.mid(2).trimmed();
......@@ -2577,9 +2580,11 @@ QString GitClient::extendedShowDescription(const QString &workingDirectory, cons
moreBranches = tr(" and %1 more").arg(branchCount - leave);
branches.erase(branches.begin() + leave, branches.end());
}
modText.insert(lastHeaderLine, QLatin1String("Branches: ")
+ branches.join(QLatin1String(", ")) + moreBranches
+ QLatin1Char('\n'));
if (!branches.isEmpty()) {
modText.insert(lastHeaderLine, QLatin1String("Branches: ")
+ branches.join(QLatin1String(", ")) + moreBranches
+ QLatin1Char('\n'));
}
return modText;
}
......
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