diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2013-08-29 11:36:37 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2013-08-30 10:42:38 +0200 |
commit | 47b01acd32d7ae8c2bf343a077c8f9efc716dee0 (patch) | |
tree | f3e432ad185bfd009ac6504cc2df6cd54238d5f5 /src/plugins/git/gitclient.cpp | |
parent | 35fce3c2add7cc9fc822ecb19822bfe94de6fb35 (diff) | |
download | qt-creator-47b01acd32d7ae8c2bf343a077c8f9efc716dee0.tar.gz |
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: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src/plugins/git/gitclient.cpp')
-rw-r--r-- | src/plugins/git/gitclient.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index c7e5dfeac7..5f416155d4 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -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; } |