aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/git
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2022-10-11 15:54:05 +0300
committerOrgad Shaneh <orgads@gmail.com>2022-10-11 15:32:13 +0000
commit8c1cd7539c3933a07cd8855b6eea6ded075e6d90 (patch)
tree35386e8e523912d63a2b2748fdebcb7b9aae96c3 /src/plugins/git
parentd2160e8b4f267e176c6f64bea58c6bfcb794764f (diff)
Git: Fix removing nested files
* Add -- before file list on add/remove. * Run in the correct directory. Fixes: QTCREATORBUG-27405 Change-Id: Ie04cd19981dac465cf70dba8b089fd18a4ecdf8b Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/plugins/git')
-rw-r--r--src/plugins/git/gitclient.cpp5
-rw-r--r--src/plugins/git/gitplugin.cpp2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 3dd289654f..50ba504781 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -1531,7 +1531,9 @@ bool GitClient::synchronousAdd(const FilePath &workingDirectory,
const QStringList &extraOptions)
{
QStringList args{"add"};
- args += extraOptions + files;
+ args += extraOptions;
+ args += "--";
+ args += files;
return vcsSynchronousExec(workingDirectory, args).result()
== ProcessResult::FinishedWithSuccess;
}
@@ -1543,6 +1545,7 @@ bool GitClient::synchronousDelete(const FilePath &workingDirectory,
QStringList arguments = {"rm"};
if (force)
arguments << "--force";
+ arguments << "--";
arguments.append(files);
return vcsSynchronousExec(workingDirectory, arguments).result()
== ProcessResult::FinishedWithSuccess;
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index 0972ac8b36..d93b66f4f7 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -1834,7 +1834,7 @@ bool GitPluginPrivate::vcsAdd(const FilePath &filePath)
bool GitPluginPrivate::vcsDelete(const FilePath &filePath)
{
- return m_gitClient.synchronousDelete(filePath.parentDir().absolutePath(), true, {filePath.fileName()});
+ return m_gitClient.synchronousDelete(filePath.absolutePath(), true, {filePath.fileName()});
}
bool GitPluginPrivate::vcsMove(const FilePath &from, const FilePath &to)