forked from qt-creator/qt-creator
Git: Use file directory as editor source for files opened inside git dir
* git rev-parse --show-toplevel doesn't work inside git dir. * Only "Describe (show)" should be available for those files. show works when running from inside the git dir Change-Id: If5f3d1af8da2f8d149ac1e03ffd70b530e609557 Reviewed-by: Petar Perisin <petar.perisin@gmail.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
879012a50b
commit
96a0920440
@@ -797,19 +797,6 @@ QString GitClient::findGitDirForRepository(const QString &repositoryDir) const
|
||||
return res;
|
||||
}
|
||||
|
||||
QString GitClient::findRepositoryForGitDir(const QString &gitDir) const
|
||||
{
|
||||
static QHash<QString, QString> gitDirCache;
|
||||
QString &res = gitDirCache[gitDir];
|
||||
if (!res.isEmpty())
|
||||
return res;
|
||||
QByteArray outputText;
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("rev-parse") << QLatin1String("--show-toplevel");
|
||||
fullySynchronousGit(gitDir, arguments, &outputText, 0, false);
|
||||
return QString::fromLocal8Bit(outputText.trimmed());
|
||||
}
|
||||
|
||||
VcsBase::VcsBaseEditorWidget *GitClient::findExistingVCSEditor(const char *registerDynamicProperty,
|
||||
const QString &dynamicPropertyValue) const
|
||||
{
|
||||
|
@@ -136,7 +136,6 @@ public:
|
||||
|
||||
QString findRepositoryForDirectory(const QString &dir);
|
||||
QString findGitDirForRepository(const QString &repositoryDir) const;
|
||||
QString findRepositoryForGitDir(const QString &gitDir) const;
|
||||
|
||||
void diff(const QString &workingDirectory, const QStringList &diffArgs, const QString &fileName);
|
||||
void diff(const QString &workingDirectory, const QStringList &diffArgs,
|
||||
|
@@ -246,7 +246,7 @@ bool GitEditor::open(QString *errorString, const QString &fileName, const QStrin
|
||||
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID
|
||||
|| editorId == Git::Constants::GIT_REBASE_EDITOR_ID) {
|
||||
QFileInfo fi(fileName);
|
||||
setSource(GitPlugin::instance()->gitClient()->findRepositoryForGitDir(fi.absolutePath()));
|
||||
setSource(fi.absolutePath());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user