<commit_before>#!/dev/null

if ! test "${#}" -eq 0 ; then
	echo "[ee] invalid arguments; aborting!" >&2
	exit 1
fi

"${_git_bin}" submodule foreach --quiet 'echo "$( pwd ) ${name} ${sha1}"' \
| while read path name sha1 ; do
	path="$( readlink -e "${name}" )"
	name="$( basename "${name}" )"
	orig_path="$( readlink -e ../mosaic-repositories )/${name}"
	if test ! -e "${orig_path}" ; then
		echo "[ww] ?? ${name}" >&2
		continue
	fi
	origin_sha1="$( cd "${orig_path}" ; exec git rev-parse HEAD ; )"
	if test "${sha1}" != "${origin_sha1}" ; then
		echo "[ww] ## ${name} -> ${origin_sha1}" >&2
		( cd "${path}" ; exec git fetch ; )
		if ( cd "${path}" ; exec git cat-file -e "${origin_sha1}" ; ) ; then
			( cd "${path}" ; exec git checkout "${origin_sha1}" ; )
		else
			echo "[ee] #### !!!!" >&2
		fi
	else
		echo "[ii] -- ${name}" >&2
	fi
done

exit 0<commit_msg>Update scripts<commit_after>#!/dev/null

if ! test "${#}" -eq 0 ; then
	echo "[ee] invalid arguments; aborting!" >&2
	exit 1
fi

"${_git_bin}" submodule foreach --quiet 'echo "$( pwd ) ${name} ${sha1}"' \
| while read path name sha1 ; do
	path="$( readlink -e "${name}" )"
	name="$( basename "${name}" )"
	orig_path="$( readlink -e ../mosaic-repositories )/${name}"
	if test "${orig_path}" == "${path}" ; then
		continue
	fi
	if test ! -e "${orig_path}" ; then
		echo "[ww] ?? ${name}" >&2
		continue
	fi
	origin_sha1="$( cd "${orig_path}" ; exec git rev-parse HEAD ; )"
	if test "${sha1}" != "${origin_sha1}" ; then
		echo "[ww] ## ${name} -> ${origin_sha1}" >&2
		( cd "${path}" ; exec git fetch ; )
		if ( cd "${path}" ; exec git cat-file -e "${origin_sha1}" ; ) ; then
			( cd "${path}" ; exec git checkout "${origin_sha1}" ; )
		else
			echo "[ee] #### !!!!" >&2
		fi
	else
		echo "[ii] -- ${name}" >&2
	fi
done

exit 0
{'fraction_non_alphanumeric': 0.24440715883668904, 'fraction_numerical': 0.017897091722595078, 'mean_word_length': 3.4392059553349874, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5791082', 'n_tokens_mistral': 728, 'n_tokens_neox': 670, 'n_words': 213}