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

Method setupCommitMessageEditor

plugins/git/gitplugin.cpp:1748–1761  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1746}
1747
1748void GitPlugin::setupCommitMessageEditor(const QUrl& localLocation, KTextEdit* editor) const
1749{
1750 new GitMessageHighlighter(editor);
1751 QFile mergeMsgFile(dotGitDirectory(localLocation).filePath(QStringLiteral(".git/MERGE_MSG")));
1752 // Some limit on the file size should be set since whole content is going to be read into
1753 // the memory. 1Mb seems to be good value since it's rather strange to have so huge commit
1754 // message.
1755 static const qint64 maxMergeMsgFileSize = 1024*1024;
1756 if (mergeMsgFile.size() > maxMergeMsgFileSize || !mergeMsgFile.open(QIODevice::ReadOnly))
1757 return;
1758
1759 QString mergeMsg = QString::fromLocal8Bit(mergeMsgFile.read(maxMergeMsgFileSize));
1760 editor->setPlainText(mergeMsg);
1761}
1762
1763class GitVcsLocationWidget : public KDevelop::StandardVcsLocationWidget
1764{

Callers

nothing calls this directly

Calls 5

dotGitDirectoryFunction · 0.85
filePathMethod · 0.45
sizeMethod · 0.45
openMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected