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