<commit_before>#!/bin/sh
##
## "dotest" is my stupid name for my patch-application script, which
## I never got around to renaming after I tested it. We're now on the
## second generation of scripts, still called "dotest".
##
## Update: <NAME> finally shamed me into naming this "applymbox".
##
## You give it a mbox-format collection of emails, and it will try to
## apply them to the kernel using "applypatch"
##
## The patch application may fail in the middle.  In which case:
## (1) look at .dotest/patch and fix it up to apply
## (2) re-run applymbox with -c .dotest/msg-number for the current one.
## Pay a special attention to the commit log message if you do this and
## use a Signoff_file, because applypatch wants to append the sign-off
## message to msg-clean every time it is run.
##
## git-am is supposed to be the newer and better tool for this job.

. git-sh-setup

usage () {
    echo >&2 "applymbox [-u] [-k] [-q] [-m] (-c .dotest/<num> | mbox) [signoff]"
    exit 1
}

keep_subject= query_apply= continue= utf8= resume=t
while case "$#" in 0) break ;; esac
do
	case "$1" in
	-u)	utf8=-u ;;
	-k)	keep_subject=-k ;;
	-q)	query_apply=t ;;
	-c)	continue="$2"; resume=f; shift ;;
	-m)	fallback_3way=t ;;
	-*)	usage ;;
	*)	break ;;
	esac
	shift
done

case "$continue" in
'')
	rm -rf .dotest
	mkdir .dotest
	num_msgs=$(git-mailsplit "$1" .dotest) || exit 1
	echo "$num_msgs patch(es) to process."
	shift
esac

files=$(git-diff-index --cached --name-only HEAD) || exit
if [ "$files" ]; then
   echo "Dirty index: cannot apply patches (dirty: $files)" >&2
   exit 1
fi

case "$query_apply" in
t)	touch .dotest/.query_apply
esac
case "$fall_back_3way" in
t)	: >.dotest/.3way<commit_msg>applymbox: typofix to enable -m option.<commit_after>#!/bin/sh
##
## "dotest" is my stupid name for my patch-application script, which
## I never got around to renaming after I tested it. We're now on the
## second generation of scripts, still called "dotest".
##
## Update: <NAME> finally shamed me into naming this "applymbox".
##
## You give it a mbox-format collection of emails, and it will try to
## apply them to the kernel using "applypatch"
##
## The patch application may fail in the middle.  In which case:
## (1) look at .dotest/patch and fix it up to apply
## (2) re-run applymbox with -c .dotest/msg-number for the current one.
## Pay a special attention to the commit log message if you do this and
## use a Signoff_file, because applypatch wants to append the sign-off
## message to msg-clean every time it is run.
##
## git-am is supposed to be the newer and better tool for this job.

. git-sh-setup

usage () {
    echo >&2 "applymbox [-u] [-k] [-q] [-m] (-c .dotest/<num> | mbox) [signoff]"
    exit 1
}

keep_subject= query_apply= continue= utf8= resume=t
while case "$#" in 0) break ;; esac
do
	case "$1" in
	-u)	utf8=-u ;;
	-k)	keep_subject=-k ;;
	-q)	query_apply=t ;;
	-c)	continue="$2"; resume=f; shift ;;
	-m)	fall_back_3way=t ;;
	-*)	usage ;;
	*)	break ;;
	esac
	shift
done

case "$continue" in
'')
	rm -rf .dotest
	mkdir .dotest
	num_msgs=$(git-mailsplit "$1" .dotest) || exit 1
	echo "$num_msgs patch(es) to process."
	shift
esac

files=$(git-diff-index --cached --name-only HEAD) || exit
if [ "$files" ]; then
   echo "Dirty index: cannot apply patches (dirty: $files)" >&2
   exit 1
fi

case "$query_apply" in
t)	touch .dotest/.query_apply
esac
case "$fall_back_3way" in
t)	: >.dotest/.3way
{'fraction_non_alphanumeric': 0.1431918008784773, 'fraction_numerical': 0.009370424597364568, 'mean_word_length': 3.579088471849866, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '3777781', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1205, 'n_words': 478}