forked from qt-creator/qt-creator
Git: Figure out codec for amend commit
Change-Id: Ib8fddbb8343f92cf74b99117999ec033b1785404 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
committed by
Tobias Hunger
parent
8382dd7a03
commit
73138f633f
@@ -1641,11 +1641,12 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
|||||||
|
|
||||||
// Get the commit template or the last commit message
|
// Get the commit template or the last commit message
|
||||||
if (amend) {
|
if (amend) {
|
||||||
// Amend: get last commit data as "SHA1@message". TODO: Figure out codec.
|
// Amend: get last commit data as "SHA1@message".
|
||||||
QStringList args(QLatin1String("log"));
|
QStringList args(QLatin1String("log"));
|
||||||
const QString format = synchronousGitVersion(true) > 0x010701 ? "%h@%B" : "%h@%s%n%n%b";
|
const QString format = synchronousGitVersion(true) > 0x010701 ? "%h@%B" : "%h@%s%n%n%b";
|
||||||
args << QLatin1String("--max-count=1") << QLatin1String("--pretty=format:") + format;
|
args << QLatin1String("--max-count=1") << QLatin1String("--pretty=format:") + format;
|
||||||
const Utils::SynchronousProcessResponse sp = synchronousGit(repoDirectory, args);
|
QTextCodec *codec = QTextCodec::codecForName(commitData->commitEncoding.toLocal8Bit());
|
||||||
|
const Utils::SynchronousProcessResponse sp = synchronousGit(repoDirectory, args, 0, codec);
|
||||||
if (sp.result != Utils::SynchronousProcessResponse::Finished) {
|
if (sp.result != Utils::SynchronousProcessResponse::Finished) {
|
||||||
*errorMessage = tr("Cannot retrieve last commit data of repository \"%1\".").arg(repoDirectory);
|
*errorMessage = tr("Cannot retrieve last commit data of repository \"%1\".").arg(repoDirectory);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -673,7 +673,6 @@ void GitPlugin::startCommit()
|
|||||||
|
|
||||||
void GitPlugin::startCommit(bool amend)
|
void GitPlugin::startCommit(bool amend)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (VCSBase::VCSBaseSubmitEditor::raiseSubmitEditor())
|
if (VCSBase::VCSBaseSubmitEditor::raiseSubmitEditor())
|
||||||
return;
|
return;
|
||||||
if (isCommitEditorOpen()) {
|
if (isCommitEditorOpen()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user