Skip to content

Error out if error happens in fast import process #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/repository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ static const int maxSimultaneousProcesses = 100;
typedef unsigned long long mark_t;
static const mark_t maxMark = ULONG_MAX;

LoggingQProcess::LoggingQProcess(const QString filename)
: QProcess(), log()
{
if(CommandLineParser::instance()->contains("debug-rules")) {
logging = true;
QString name = filename;
name.replace('/', '_');
name.prepend("gitlog-");
log.setFileName(name);
log.open(QIODevice::WriteOnly);
} else {
logging = false;
}

// Trigger a crictical error if any error in the process happens
connect(this, &QProcess::errorOccurred, this,
[this](QProcess::ProcessError error) {
qCritical() << "Error happened in fast import process, error code: '" << error <<"'";
});
};

class FastImportRepository : public Repository
{
public:
Expand Down
13 changes: 1 addition & 12 deletions src/repository.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,7 @@ class LoggingQProcess : public QProcess
QFile log;
bool logging;
public:
LoggingQProcess(const QString filename) : QProcess(), log() {
if(CommandLineParser::instance()->contains("debug-rules")) {
logging = true;
QString name = filename;
name.replace('/', '_');
name.prepend("gitlog-");
log.setFileName(name);
log.open(QIODevice::WriteOnly);
} else {
logging = false;
}
};
LoggingQProcess(const QString filename);
~LoggingQProcess() {
if(logging) {
log.close();
Expand Down