Git: Add new files with --intent-to-add

Sometimes the file is modified after adding it, either by Qt Creator itself
or by the user.

Running Diff on such a file may look strange. Instead of showing the entire
file, it shows the diff since it was added with its initial content.

Fixes: QTCREATORBUG-23441
Change-Id: I712cc574053f39753250685aec148d2b6d7db192
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2020-06-13 23:15:29 +03:00
committed by Orgad Shaneh
parent 32af4d9e70
commit c0c5773345
3 changed files with 10 additions and 6 deletions

View File

@@ -1859,7 +1859,7 @@ bool GitPluginPrivate::vcsOpen(const QString & /*fileName*/)
bool GitPluginPrivate::vcsAdd(const QString & fileName)
{
const QFileInfo fi(fileName);
return m_gitClient.synchronousAdd(fi.absolutePath(), {fi.fileName()});
return m_gitClient.synchronousAdd(fi.absolutePath(), {fi.fileName()}, {"--intent-to-add"});
}
bool GitPluginPrivate::vcsDelete(const QString & fileName)