forked from qt-creator/qt-creator
Git: Factor out commitEncoding
Task-number: QTCREATORBUG-11115 Change-Id: I58f3759c13d963aaf3e7891d7cc0a41c1ae14ecd Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
2f8ca8f81a
commit
86d7916b5b
@@ -3027,6 +3027,16 @@ QString GitClient::gitBinaryPath(bool *ok, QString *errorMessage) const
|
|||||||
return settings()->gitBinaryPath(ok, errorMessage);
|
return settings()->gitBinaryPath(ok, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString GitClient::commitEncoding(const QString &workingDirectory)
|
||||||
|
{
|
||||||
|
QString encoding = readConfigValue(workingDirectory, QLatin1String("i18n.commitEncoding"));
|
||||||
|
if (!encoding.isEmpty())
|
||||||
|
return encoding;
|
||||||
|
// Set default commit encoding to 'UTF-8', when it's not set,
|
||||||
|
// to solve displaying error of commit log with non-latin characters.
|
||||||
|
return QLatin1String("UTF-8");
|
||||||
|
}
|
||||||
|
|
||||||
bool GitClient::getCommitData(const QString &workingDirectory,
|
bool GitClient::getCommitData(const QString &workingDirectory,
|
||||||
QString *commitTemplate,
|
QString *commitTemplate,
|
||||||
CommitData &commitData,
|
CommitData &commitData,
|
||||||
@@ -3106,12 +3116,7 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
commitData.commitEncoding = readConfigValue(workingDirectory, QLatin1String("i18n.commitEncoding"));
|
commitData.commitEncoding = commitEncoding(workingDirectory);
|
||||||
|
|
||||||
// Set default commit encoding to 'UTF-8', when it's not set,
|
|
||||||
// to solve displaying error of commit log with non-latin characters.
|
|
||||||
if (commitData.commitEncoding.isEmpty())
|
|
||||||
commitData.commitEncoding = QLatin1String("UTF-8");
|
|
||||||
|
|
||||||
// Get the commit template or the last commit message
|
// Get the commit template or the last commit message
|
||||||
switch (commitData.commitType) {
|
switch (commitData.commitType) {
|
||||||
|
|||||||
@@ -285,6 +285,7 @@ public:
|
|||||||
|
|
||||||
QString readConfigValue(const QString &workingDirectory, const QString &configVar) const;
|
QString readConfigValue(const QString &workingDirectory, const QString &configVar) const;
|
||||||
|
|
||||||
|
QString commitEncoding(const QString &workingDirectory);
|
||||||
bool getCommitData(const QString &workingDirectory, QString *commitTemplate,
|
bool getCommitData(const QString &workingDirectory, QString *commitTemplate,
|
||||||
CommitData &commitData, QString *errorMessage);
|
CommitData &commitData, QString *errorMessage);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user