Commit 6a17d889 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Tobias Hunger
Browse files

Git: Find correct topLevel



Task-number: QTCREATORBUG-6756

Change-Id: Iefaa8cb112f7da6e6eb76ec852f8f61abcd626ef
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 55324926
......@@ -361,9 +361,17 @@ const char *GitClient::decorateOption = "--decorate";
QString GitClient::findRepositoryForDirectory(const QString &dir)
{
// Check for ".git/config"
const QString checkFile = QLatin1String(GIT_DIRECTORY) + QLatin1String("/config");
return VcsBase::VcsBasePlugin::findRepositoryForDirectory(dir, checkFile);
if (synchronousGitVersion(true) >= 0x010700) {
QByteArray outputText;
QStringList arguments;
arguments << QLatin1String("rev-parse") << QLatin1String("--show-toplevel");
fullySynchronousGit(dir, arguments, &outputText, 0, false);
return outputText.trimmed();
} else {
// Check for ".git/config"
const QString checkFile = QLatin1String(GIT_DIRECTORY) + QLatin1String("/config");
return VcsBase::VcsBasePlugin::findRepositoryForDirectory(dir, checkFile);
}
}
VcsBase::VcsBaseEditorWidget *GitClient::findExistingVCSEditor(const char *registerDynamicProperty,
......
......@@ -87,7 +87,7 @@ public:
unsigned gitVersion(bool silent, QString *errorMessage = 0) const;
QString gitVersionString(bool silent, QString *errorMessage = 0) const;
static QString findRepositoryForDirectory(const QString &dir);
QString findRepositoryForDirectory(const QString &dir);
void diff(const QString &workingDirectory, const QStringList &diffArgs, const QString &fileName);
void diff(const QString &workingDirectory, const QStringList &diffArgs,
......
......@@ -230,7 +230,7 @@ bool GitVersionControl::vcsRemoveSnapshot(const QString &topLevel, const QString
bool GitVersionControl::managesDirectory(const QString &directory, QString *topLevel) const
{
const QString topLevelFound = GitClient::findRepositoryForDirectory(directory);
const QString topLevelFound = m_client->findRepositoryForDirectory(directory);
if (topLevel)
*topLevel = topLevelFound;
return !topLevelFound.isEmpty();
......
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