MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / updateIndex

Method updateIndex

3rdparty/unioncode-GitQlient/src/git/GitLocal.cpp:255–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255GitExecResult 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}

Callers

nothing calls this directly

Calls 7

quoteFunction · 0.85
statusCmpMethod · 0.80
GitExecResultClass · 0.70
QStringClass · 0.50
indexOfMethod · 0.45
isEmptyMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected