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

Method ammendCommit

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

Source from the content-addressed store, hash-verified

224}
225
226GitExecResult GitLocal::ammendCommit(const QStringList &selFiles, const RevisionFiles &allCommitFiles,
227 const QString &msg, const QString &author) const
228{
229 QStringList notSel;
230
231 for (auto i = 0; i < allCommitFiles.count(); ++i)
232 {
233 const QString &fp = allCommitFiles.getFile(i);
234 if (selFiles.indexOf(fp) == -1 && allCommitFiles.statusCmp(i, RevisionFiles::IN_INDEX)
235 && !allCommitFiles.statusCmp(i, RevisionFiles::DELETED))
236 notSel.append(fp);
237 }
238
239 QLog_Debug("Git", QString("Amending files"));
240
241 QString cmtOptions;
242
243 if (!author.isEmpty())
244 cmtOptions.append(QString(" --author \"%1\"").arg(author));
245
246 const auto cmd = QString("git commit --amend" + cmtOptions + " -m \"%1\"").arg(msg);
247
248 QLog_Trace("Git", QString("Amending files: {%1}").arg(cmd));
249
250 const auto ret = mGitBase->run(cmd);
251
252 return ret;
253}
254
255GitExecResult GitLocal::updateIndex(const RevisionFiles &files, const QStringList &selFiles) const
256{

Callers 1

commitChangesMethod · 0.80

Calls 8

statusCmpMethod · 0.80
QStringClass · 0.50
countMethod · 0.45
getFileMethod · 0.45
indexOfMethod · 0.45
appendMethod · 0.45
isEmptyMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected