Commit 86d7916b authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Git: Factor out commitEncoding



Task-number: QTCREATORBUG-11115

Change-Id: I58f3759c13d963aaf3e7891d7cc0a41c1ae14ecd
Reviewed-by: default avatarAndré Hartmann <aha_1980@gmx.de>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 2f8ca8f8
......@@ -3027,6 +3027,16 @@ QString GitClient::gitBinaryPath(bool *ok, QString *errorMessage) const
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,
QString *commitTemplate,
CommitData &commitData,
......@@ -3106,12 +3116,7 @@ bool GitClient::getCommitData(const QString &workingDirectory,
}
}
commitData.commitEncoding = readConfigValue(workingDirectory, QLatin1String("i18n.commitEncoding"));
// 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");
commitData.commitEncoding = commitEncoding(workingDirectory);
// Get the commit template or the last commit message
switch (commitData.commitType) {
......
......@@ -285,6 +285,7 @@ public:
QString readConfigValue(const QString &workingDirectory, const QString &configVar) const;
QString commitEncoding(const QString &workingDirectory);
bool getCommitData(const QString &workingDirectory, QString *commitTemplate,
CommitData &commitData, QString *errorMessage);
......
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