<commit_before>#!/bin/sh

test_description='Various filesystem issues'

. ./test-lib.sh

auml=$(printf '\303\244')
aumlcdiar=$(printf '\141\314\210')

case_insensitive=
unibad=
no_symlinks=
test_expect_success 'see what we expect' '

	test_case=test_expect_success &&
	test_unicode=test_expect_success &&
	mkdir junk &&
	echo good >junk/CamelCase &&
	echo bad >junk/camelcase &&
	if test "$(cat junk/CamelCase)" != good
	then
		test_case=test_expect_failure &&
		case_insensitive=t
	fi &&
	rm -fr junk &&
	mkdir junk &&
	>junk/"$auml" &&
	case "$(cd junk && echo *)" in
	"$aumlcdiar")
		test_unicode=test_expect_failure &&
		unibad=t
		;;
	*)	;;
	esac &&
	rm -fr junk &&
	{
		ln -s x y 2> /dev/null &&
		test -h y 2> /dev/null ||
		no_symlinks=1 &&
		rm -f y
	}
'

test "$case_insensitive" &&
	say "will test on a case insensitive filesystem"
test "$unibad" &&
	say "will test on a unicode corrupting filesystem"
test "$no_symlinks" &&
	say "will test on a filesystem lacking symbolic links"

if test "$case_insensitive"
then
test_expect_success "detection of case insensitive filesystem during repo init" '

	test $(git config --bool core.ignorecase) = true
'
else
test_expect_success "detection of case insensitive filesystem during repo init" '

	test_must_fail git config --bool core.ignorecase >/dev/null ||
	test $(git config --bool core.ignorecase) = false
'
fi

if test "$no_symlinks"
then
test_expect_success "detection of filesystem w/o symlink support during repo init" '

	v=$(git config --bool core.symlinks) &&
	test "$v" = false
'
else
test_expect_success "detection of filesystem w/o symlink support during repo init" '

	test_must_fail git config --bool core.symlinks ||
	test "$(git config --bool core.symlinks)" = true
'
fi

test_expect_success "setup case tests" '<commit_msg>t0050: use the CASE_INSENSITIVE_FS test prereq<commit_after>#!/bin/sh

test_description='Various filesystem issues'

. ./test-lib.sh

auml=$(printf '\303\244')
aumlcdiar=$(printf '\141\314\210')

unibad=
no_symlinks=
test_expect_success 'see what we expect' '

	test_unicode=test_expect_success &&
	mkdir junk &&
	>junk/"$auml" &&
	case "$(cd junk && echo *)" in
	"$aumlcdiar")
		test_unicode=test_expect_failure &&
		unibad=t
		;;
	*)	;;
	esac &&
	rm -fr junk &&
	{
		ln -s x y 2> /dev/null &&
		test -h y 2> /dev/null ||
		no_symlinks=1 &&
		rm -f y
	}
'

if test_have_prereq CASE_INSENSITIVE_FS
then
	say "will test on a case insensitive filesystem"
	test_case=test_expect_failure
else
	test_case=test_expect_success
fi

test "$unibad" &&
	say "will test on a unicode corrupting filesystem"
test "$no_symlinks" &&
	say "will test on a filesystem lacking symbolic links"

if test_have_prereq CASE_INSENSITIVE_FS
then
test_expect_success "detection of case insensitive filesystem during repo init" '

	test $(git config --bool core.ignorecase) = true
'
else
test_expect_success "detection of case insensitive filesystem during repo init" '

	test_must_fail git config --bool core.ignorecase >/dev/null ||
	test $(git config --bool core.ignorecase) = false
'
fi

if test "$no_symlinks"
then
test_expect_success "detection of filesystem w/o symlink support during repo init" '

	v=$(git config --bool core.symlinks) &&
	test "$v" = false
'
else
test_expect_success "detection of filesystem w/o symlink support during repo init" '

	test_must_fail git config --bool core.symlinks ||
	test "$(git config --bool core.symlinks)" = true
'
fi

test_expect_success "setup case tests" '
{'fraction_non_alphanumeric': 0.11805355600345523, 'fraction_numerical': 0.01151742009789807, 'mean_word_length': 4.344615384615385, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3061363', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1198, 'n_words': 369}