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

Method commitFiles

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

Source from the content-addressed store, hash-verified

193}
194
195GitExecResult GitLocal::commitFiles(QStringList &selFiles, const RevisionFiles &allCommitFiles,
196 const QString &msg) const
197{
198 QStringList notSel;
199
200 for (auto i = 0; i < allCommitFiles.count(); ++i)
201 {
202 if (const auto &fp = allCommitFiles.getFile(i);
203 selFiles.indexOf(fp) == -1 && allCommitFiles.statusCmp(i, RevisionFiles::IN_INDEX))
204 {
205 notSel.append(fp);
206 }
207 }
208
209 if (const auto updIdx = updateIndex(allCommitFiles, selFiles); !updIdx.success)
210 return updIdx;
211
212 QLog_Debug("Git", QString("Committing files"));
213
214 const auto cmd = QString("git commit -m \"%1\"").arg(msg);
215
216 QLog_Trace("Git", QString("Committing files: {%1}").arg(cmd));
217
218 auto ret = mGitBase->run(cmd);
219
220 if (ret.output.startsWith("On branch"))
221 ret.output = false;
222
223 return ret;
224}
225
226GitExecResult GitLocal::ammendCommit(const QStringList &selFiles, const RevisionFiles &allCommitFiles,
227 const QString &msg, const QString &author) const

Callers 1

commitChangesMethod · 0.80

Calls 8

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

Tested by

no test coverage detected