| 253 | } |
| 254 | |
| 255 | GitExecResult GitLocal::updateIndex(const RevisionFiles &files, const QStringList &selFiles) const |
| 256 | { |
| 257 | QStringList toRemove; |
| 258 | |
| 259 | for (const auto &file : selFiles) |
| 260 | { |
| 261 | const auto index = files.mFiles.indexOf(file); |
| 262 | |
| 263 | if (index != -1 && files.statusCmp(index, RevisionFiles::DELETED)) |
| 264 | toRemove << file; |
| 265 | } |
| 266 | |
| 267 | if (!toRemove.isEmpty()) |
| 268 | { |
| 269 | const auto cmd = QString("git rm --cached --ignore-unmatch -- " + quote(toRemove)); |
| 270 | |
| 271 | QLog_Trace("Git", QString("Updating index for files: {%1}").arg(cmd)); |
| 272 | |
| 273 | const auto ret = mGitBase->run(cmd); |
| 274 | |
| 275 | if (!ret.success) |
| 276 | { |
| 277 | |
| 278 | return ret; |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | const auto ret = GitExecResult(true, "Indexes updated"); |
| 283 | |
| 284 | return ret; |
| 285 | } |