Commit 920fa796 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Git: Really add new/existing files

Task-number: QTCREATORBUG-10117

Change-Id: Ic254cb2f7860ca0973cfda58cf66f62b1b8eaeb7
Reviewed-by: default avatarFriedemann Kleint <>
Reviewed-by: default avatarTobias Hunger <>
parent 82524422
......@@ -1604,18 +1604,12 @@ bool GitClient::synchronousLog(const QString &workingDirectory, const QStringLis
return rc;
// Warning: 'intendToAdd' works only from 1.6.1 onwards
bool GitClient::synchronousAdd(const QString &workingDirectory,
bool intendToAdd,
const QStringList &files)
bool GitClient::synchronousAdd(const QString &workingDirectory, const QStringList &files)
QByteArray outputText;
QByteArray errorText;
QStringList arguments;
arguments << QLatin1String("add");
if (intendToAdd)
arguments << QLatin1String("--intent-to-add");
arguments << QLatin1String("add") << files;
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText);
if (!rc) {
msgCannotRun(tr("Cannot add %n file(s) to \"%1\": %2", 0, files.size())
......@@ -3092,7 +3086,7 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
if (!filesToRemove.isEmpty() && !synchronousDelete(repositoryDirectory, true, filesToRemove))
return false;
if (!filesToAdd.isEmpty() && !synchronousAdd(repositoryDirectory, false, filesToAdd))
if (!filesToAdd.isEmpty() && !synchronousAdd(repositoryDirectory, filesToAdd))
return false;
// Do the final commit
......@@ -159,10 +159,7 @@ public:
bool synchronousLog(const QString &workingDirectory,
const QStringList &arguments,
QString *output, QString *errorMessage = 0);
bool synchronousAdd(const QString &workingDirectory,
// Warning: Works only from 1.6.1 onwards
bool intendToAdd,
const QStringList &files);
bool synchronousAdd(const QString &workingDirectory, const QStringList &files);
bool synchronousDelete(const QString &workingDirectory,
bool force,
const QStringList &files);
......@@ -86,9 +86,8 @@ bool GitVersionControl::vcsOpen(const QString & /*fileName*/)
bool GitVersionControl::vcsAdd(const QString & fileName)
// Implement in terms of using "--intent-to-add"
const QFileInfo fi(fileName);
return m_client->synchronousAdd(fi.absolutePath(), true, QStringList(fi.fileName()));
return m_client->synchronousAdd(fi.absolutePath(), QStringList(fi.fileName()));
bool GitVersionControl::vcsDelete(const QString & fileName)
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