TODO: git doesn't like empty messages, but "KDevelop didn't provide any message, it may be a bug" looks ugly... If no files specified then commit already added files
| 521 | //TODO: git doesn't like empty messages, but "KDevelop didn't provide any message, it may be a bug" looks ugly... |
| 522 | //If no files specified then commit already added files |
| 523 | VcsJob* GitPlugin::commit(const QString& message, |
| 524 | const QList<QUrl>& localLocations, |
| 525 | KDevelop::IBasicVersionControl::RecursionMode recursion) |
| 526 | { |
| 527 | if (localLocations.empty() || message.isEmpty()) |
| 528 | return makeVcsErrorJob(i18n("No files or message specified"), this); |
| 529 | |
| 530 | const QDir dir = dotGitDirectory(localLocations.front()); |
| 531 | if (!ensureValidGitIdentity(dir)) { |
| 532 | return makeVcsErrorJob(i18n("Email or name for Git not specified"), this); |
| 533 | } |
| 534 | |
| 535 | auto* job = new GitJob(dir, this); |
| 536 | job->setType(VcsJob::Commit); |
| 537 | QList<QUrl> files = (recursion == IBasicVersionControl::Recursive ? localLocations : preventRecursion(localLocations)); |
| 538 | addNotVersionedFiles(dir, files); |
| 539 | |
| 540 | *job << "git" << "commit" << "-m" << message; |
| 541 | *job << "--" << files; |
| 542 | return job; |
| 543 | } |
| 544 | |
| 545 | KDevelop::VcsJob * GitPlugin::commitStaged(const QString& message, const QUrl& repoUrl) |
| 546 | { |