forked from qt-creator/qt-creator
Git: Use git describe for topic before falling back to "Detach Head"
Change-Id: Iaf8be78ac3b6119f01ad3491eec7eccfa5f45e26 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
f74021260a
commit
1817c48c7b
@@ -2052,9 +2052,19 @@ QString GitClient::synchronousTopic(const QString &workingDirectory)
|
|||||||
(derefInd == -1) ? -1 : derefInd - remoteStart.size());
|
(derefInd == -1) ? -1 : derefInd - remoteStart.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!remoteBranch.isEmpty())
|
||||||
|
return remoteBranch;
|
||||||
|
|
||||||
// No tag
|
// No tag or remote branch - try git describe
|
||||||
return remoteBranch.isEmpty() ? tr("Detached HEAD") : remoteBranch;
|
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,
|
bool GitClient::synchronousRevParseCmd(const QString &workingDirectory, const QString &ref,
|
||||||
|
|||||||
Reference in New Issue
Block a user