diff options
| author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2014-02-26 22:03:55 +0200 |
|---|---|---|
| committer | Orgad Shaneh <orgads@gmail.com> | 2014-02-27 14:44:54 +0100 |
| commit | 1817c48c7bcdbb334ffb27e2410704ecc8f35b30 (patch) | |
| tree | 2cdebce73298f26dc4dbf9beb4e914e25d272225 /src | |
| parent | f74021260a0b81c9b74532e9a4ce868ed351760c (diff) | |
| download | qt-creator-1817c48c7bcdbb334ffb27e2410704ecc8f35b30.tar.gz | |
Git: Use `git describe` for topic before falling back to "Detach Head"
Change-Id: Iaf8be78ac3b6119f01ad3491eec7eccfa5f45e26
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugins/git/gitclient.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 8c918a3c4b..507a11dbb4 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2052,9 +2052,19 @@ QString GitClient::synchronousTopic(const QString &workingDirectory) (derefInd == -1) ? -1 : derefInd - remoteStart.size()); } } + if (!remoteBranch.isEmpty()) + return remoteBranch; - // No tag - return remoteBranch.isEmpty() ? tr("Detached HEAD") : remoteBranch; + // No tag or remote branch - try git describe + QByteArray output; + QStringList arguments; + arguments << QLatin1String("describe"); + if (fullySynchronousGit(workingDirectory, arguments, &output, 0, VcsBasePlugin::NoOutput)) { + const QString describeOutput = commandOutputFromLocal8Bit(output.trimmed()); + if (!describeOutput.isEmpty()) + return describeOutput; + } + return tr("Detached HEAD"); } bool GitClient::synchronousRevParseCmd(const QString &workingDirectory, const QString &ref, |
