GitClient: Simplify recipe

Use LoopList element instead of constructing large tree.

Change-Id: Ie10af350c7ed15a7d06363414174042b65c7ec53
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2024-07-08 19:18:49 +02:00
parent 9035454afb
commit faff9bb220

View File

@@ -493,27 +493,28 @@ ShowController::ShowController(IDocument *document, const QString &id)
data->m_follows = {busyMessage}; data->m_follows = {busyMessage};
data->m_follows.resize(parents.size()); data->m_follows.resize(parents.size());
const auto onFollowsError = [data, updateDescription] { const LoopList iterator(parents);
const auto onFollowSetup = [this, iterator](Process &process) {
setupCommand(process, {"describe", "--tags", "--abbrev=0", *iterator});
};
const auto onFollowDone = [data, updateDescription, iterator](const Process &process) {
data->m_follows[iterator.iteration()] = process.cleanedStdOut().trimmed();
updateDescription(*data);
};
const auto onDone = [data, updateDescription] {
data->m_follows.clear(); data->m_follows.clear();
updateDescription(*data); updateDescription(*data);
}; };
QList<GroupItem> tasks { const Group recipe {
parallel, parallel,
continueOnSuccess, continueOnSuccess,
onGroupDone(onFollowsError, CallDoneIf::Error) iterator,
ProcessTask(onFollowSetup, onFollowDone, CallDoneIf::Success),
onGroupDone(onDone, CallDoneIf::Error)
}; };
for (int i = 0, total = parents.size(); i < total; ++i) { taskTree.setRecipe(recipe);
const auto onFollowSetup = [this, parent = parents.at(i)](Process &process) {
setupCommand(process, {"describe", "--tags", "--abbrev=0", parent});
};
const auto onFollowDone = [data, updateDescription, i](const Process &process) {
data->m_follows[i] = process.cleanedStdOut().trimmed();
updateDescription(*data);
};
tasks.append(ProcessTask(onFollowSetup, onFollowDone, CallDoneIf::Success));
}
taskTree.setRecipe(tasks);
}; };
const auto onDiffSetup = [this, id](Process &process) { const auto onDiffSetup = [this, id](Process &process) {