MCPcopy Create free account
hub / github.com/KDE/kdevelop / commit

Method commit

plugins/git/gitplugin.cpp:523–543  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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
523VcsJob* 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
545KDevelop::VcsJob * GitPlugin::commitStaged(const QString& message, const QUrl& repoUrl)
546{

Callers 8

allCommitsMethod · 0.45
commitFilesMethod · 0.45
testMergeMethod · 0.45
revHistoryMethod · 0.45
testAnnotationMethod · 0.45
testStashMethod · 0.45
initializeDVCSFunction · 0.45

Calls 5

dotGitDirectoryFunction · 0.85
preventRecursionFunction · 0.85
emptyMethod · 0.80
isEmptyMethod · 0.45
setTypeMethod · 0.45

Tested by 6

commitFilesMethod · 0.36
testMergeMethod · 0.36
revHistoryMethod · 0.36
testAnnotationMethod · 0.36
testStashMethod · 0.36