forked from qt-creator/qt-creator
Git: Support alternative topics on detached HEAD
Use tag if applicable, otherwise use HEAD hash Change-Id: I5c7298446e5a325a27d6d9b5effc02d32155b583 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
5ec925f7e7
commit
25981d918e
@@ -1115,7 +1115,7 @@ struct TopicData
|
|||||||
QString topic;
|
QString topic;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Retrieve head branch
|
// Retrieve topic (branch, tag or HEAD hash)
|
||||||
QString GitClient::synchronousTopic(const QString &workingDirectory)
|
QString GitClient::synchronousTopic(const QString &workingDirectory)
|
||||||
{
|
{
|
||||||
static QHash<QString, TopicData> topicCache;
|
static QHash<QString, TopicData> topicCache;
|
||||||
@@ -1144,7 +1144,15 @@ QString GitClient::synchronousTopic(const QString &workingDirectory)
|
|||||||
return data.topic = branch;
|
return data.topic = branch;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString();
|
// Detached HEAD, try a tag
|
||||||
|
arguments.clear();
|
||||||
|
arguments << QLatin1String("describe") << QLatin1String("--tags")
|
||||||
|
<< QLatin1String("--exact-match") << QLatin1String("HEAD");
|
||||||
|
if (fullySynchronousGit(workingDirectory, arguments, &outputTextData))
|
||||||
|
return data.topic = commandOutputFromLocal8Bit(outputTextData.trimmed());
|
||||||
|
|
||||||
|
// No tag, return HEAD hash
|
||||||
|
return data.topic = synchronousTopRevision(workingDirectory).left(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve head revision
|
// Retrieve head revision
|
||||||
|
|||||||
Reference in New Issue
Block a user