<commit_before>
#include <Hord/aux.hpp>
#include <Hord/utility.hpp>
#include <Hord/Log.hpp>
#include <Hord/IO/Defs.hpp>
#include <Hord/IO/Prop.hpp>
#include <Hord/IO/Datastore.hpp>
#include <Hord/IO/Ops.hpp>
#include <Hord/Object/Ops.hpp>
#include <Hord/Cmd/Datastore.hpp>
#include <Hord/System/Driver.hpp>
#include <Hord/System/Context.hpp>

#include <duct/IO/memstream.hpp>

#include <exception>

#include <Hord/detail/gr_core.hpp>

namespace Hord {
namespace Cmd {
namespace Datastore {

#define HORD_SCOPE_CLASS Cmd::Datastore::Init

#define HORD_SCOPE_FUNC link_parents
void
link_parents(
	IO::Datastore& datastore
) {
	auto& objects = datastore.get_objects();
	for (auto& obj_pair : objects) {
		auto& obj = *obj_pair.second;
		auto parent = obj.get_parent();
		if (obj.get_id() == parent) {
			Log::acquire(Log::error)
				<< "Object " << obj << " has itself as parent\n"
			;
			parent = Object::ID_NULL;
		} else if (!datastore.has_object(obj.get_parent())) {
			Log::acquire(Log::error)
				<< "Object " << obj << " points to invalid parent: "
				<< Object::IDPrinter{obj.get_parent()}
				<< "\n"
			;
			parent = Object::ID_NULL;<commit_msg>Cmd::Datastore::Init: corrected invalid parent check.<commit_after>
#include <Hord/aux.hpp>
#include <Hord/utility.hpp>
#include <Hord/Log.hpp>
#include <Hord/IO/Defs.hpp>
#include <Hord/IO/Prop.hpp>
#include <Hord/IO/Datastore.hpp>
#include <Hord/IO/Ops.hpp>
#include <Hord/Object/Ops.hpp>
#include <Hord/Cmd/Datastore.hpp>
#include <Hord/System/Driver.hpp>
#include <Hord/System/Context.hpp>

#include <duct/IO/memstream.hpp>

#include <exception>

#include <Hord/detail/gr_core.hpp>

namespace Hord {
namespace Cmd {
namespace Datastore {

#define HORD_SCOPE_CLASS Cmd::Datastore::Init

#define HORD_SCOPE_FUNC link_parents
void
link_parents(
	IO::Datastore& datastore
) {
	auto& objects = datastore.get_objects();
	for (auto& obj_pair : objects) {
		auto& obj = *obj_pair.second;
		auto parent = obj.get_parent();
		if (obj.get_id() == parent) {
			Log::acquire(Log::error)
				<< "Object " << obj << " has itself as parent\n"
			;
			parent = Object::ID_NULL;
		} else if (
			Object::ID_NULL != obj.get_parent() &&
			!datastore.has_object(obj.get_parent())
		) {
			Log::acquire(Log::error)
				<< "Object " << obj << " points to invalid parent: "
				<< Object::IDPrinter{obj.get_parent()}
				<< "\n"
			;
			parent = Object::ID_NULL;
{'fraction_non_alphanumeric': 0.16812682519816438, 'fraction_numerical': 0.0, 'mean_word_length': 4.437641723356009, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7139815', 'n_tokens_mistral': 992, 'n_tokens_neox': 927, 'n_words': 173}