| 224 | } |
| 225 | |
| 226 | GitExecResult 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 | |
| 255 | GitExecResult GitLocal::updateIndex(const RevisionFiles &files, const QStringList &selFiles) const |
| 256 | { |