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

Method start

plugins/git/gitplugincheckinrepositoryjob.cpp:23–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21{}
22
23void GitPluginCheckInRepositoryJob::start()
24{
25 const QTextCodec* codec = QTextCodec::codecForName(document()->encoding().toLatin1());
26 if (!codec) {
27 codec = QTextCodec::codecForLocale();
28 }
29
30 const QDir workingDirectory(m_rootDirectory);
31 if ( !workingDirectory.exists() ) {
32 emit finished(false);
33 return;
34 }
35
36 m_findjob = new QProcess(this);
37 m_findjob->setWorkingDirectory(m_rootDirectory);
38
39 m_hashjob = new QProcess(this);
40 m_hashjob->setWorkingDirectory(m_rootDirectory);
41 m_hashjob->setStandardOutputProcess(m_findjob);
42
43 connect(m_findjob, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &GitPluginCheckInRepositoryJob::repositoryQueryFinished);
44 connect(m_hashjob, &QProcess::errorOccurred, this, &GitPluginCheckInRepositoryJob::processFailed);
45 connect(m_findjob, &QProcess::errorOccurred, this, &GitPluginCheckInRepositoryJob::processFailed);
46
47 m_hashjob->start(QStringLiteral("git"), QStringList{QStringLiteral("hash-object"), QStringLiteral("--stdin")});
48 m_findjob->start(QStringLiteral("git"), QStringList{QStringLiteral("cat-file"), QStringLiteral("--batch-check")});
49
50 for ( int i = 0; i < document()->lines(); i++ ) {
51 m_hashjob->write(codec->fromUnicode(document()->line(i)));
52 if ( i != document()->lines() - 1 ) {
53 m_hashjob->write("\n");
54 }
55 }
56 m_hashjob->closeWriteChannel();
57
58}
59
60GitPluginCheckInRepositoryJob::~GitPluginCheckInRepositoryJob()
61{

Callers

nothing calls this directly

Calls 5

existsMethod · 0.80
setWorkingDirectoryMethod · 0.45
linesMethod · 0.45
writeMethod · 0.45
lineMethod · 0.45

Tested by

no test coverage detected