<commit_before>#!/bin/sh

# This script drives autorevision so that you end up with two
# `autorevision.h` files; one for including in the program and one for
# populating values in the `info.plist` file (some of which are user
# visable).
# The cache file is generated in a repo and is read from
# unconditionally when building from a tarball.
# This script is meant to called from within Xcode, some of the
# variables are defined in the environment there.

# Config
export PATH=${PATH}:/sw/bin:/opt/local/bin:/usr/local/bin:/usr/local/git/bin
sauto="${DERIVED_FILE_DIR}/autorevision.h"
fauto="${SRCROOT}/../src/autorevision.h"
xauto="${OBJROOT}/autorevision.h"
cauto="${SRCROOT}/../src/autorevision.cache"
tauto="${OBJROOT}/autorevision.tmp"


cd "${SRCROOT}/.."

# Output the autorevision cache or display it in a tarball.
if ! ./build_tools/autorevision -o "${cauto}" -t sh; then
	exit ${?}
fi


# Source the cache to allow for value manipulation.
. "${cauto}"


if [[ ! "${VCS_TICK}" = "0" ]]; then
	# If we are not exactly on a tag make the branch look better and use the value for the tag too.
	N_VCS_BRANCH="$(echo "${VCS_BRANCH}" | sed -e 's:remotes/:remote/:' -e 's:master:Master:')"
	sed -e "s:${VCS_BRANCH}:${N_VCS_BRANCH}:" -e "s:${VCS_TAG}:${N_VCS_BRANCH}:" "${cauto}" > "${tauto}"
else
	# When exactly on a tag make the value suitable for users.
	N_VCS_TAG="$(echo "${VCS_TAG}" | sed -e 's:^v::' -e 's:^v/::' | sed -e 's:_beta: Beta :' -e 's:_rc: RC :')"
	sed -e "s:${VCS_TAG}:${N_VCS_TAG}:" "${cauto}" > "${tauto}"
fi


# Output for src/autorevision.h.
./build_tools/autorevision -f -o "${cauto}" -t h > "${xauto}"
if [[ ! -f "${fauto}" ]] || ! cmp -s "${xauto}" "${fauto}"; then
	# Only copy `src/autorevision.h` in if there have been changes.<commit_msg>Fix bashisms in contrib/ as well<commit_after>#!/bin/sh

# This script drives autorevision so that you end up with two
# `autorevision.h` files; one for including in the program and one for
# populating values in the `info.plist` file (some of which are user
# visable).
# The cache file is generated in a repo and is read from
# unconditionally when building from a tarball.
# This script is meant to called from within Xcode, some of the
# variables are defined in the environment there.

# Config
export PATH=${PATH}:/sw/bin:/opt/local/bin:/usr/local/bin:/usr/local/git/bin
sauto="${DERIVED_FILE_DIR}/autorevision.h"
fauto="${SRCROOT}/../src/autorevision.h"
xauto="${OBJROOT}/autorevision.h"
cauto="${SRCROOT}/../src/autorevision.cache"
tauto="${OBJROOT}/autorevision.tmp"


cd "${SRCROOT}/.."

# Output the autorevision cache or display it in a tarball.
if ! ./build_tools/autorevision -o "${cauto}" -t sh; then
	exit ${?}
fi


# Source the cache to allow for value manipulation.
. "${cauto}"


if [ ! "${VCS_TICK}" = "0" ]; then
	# If we are not exactly on a tag make the branch look better and use the value for the tag too.
	N_VCS_BRANCH="$(echo "${VCS_BRANCH}" | sed -e 's:remotes/:remote/:' -e 's:master:Master:')"
	sed -e "s:${VCS_BRANCH}:${N_VCS_BRANCH}:" -e "s:${VCS_TAG}:${N_VCS_BRANCH}:" "${cauto}" > "${tauto}"
else
	# When exactly on a tag make the value suitable for users.
	N_VCS_TAG="$(echo "${VCS_TAG}" | sed -e 's:^v::' -e 's:^v/::' | sed -e 's:_beta: Beta :' -e 's:_rc: RC :')"
	sed -e "s:${VCS_TAG}:${N_VCS_TAG}:" "${cauto}" > "${tauto}"
fi


# Output for src/autorevision.h.
./build_tools/autorevision -f -o "${cauto}" -t h > "${xauto}"
if [ ! -f "${fauto}" ] || ! cmp -s "${xauto}" "${fauto}"; then
	# Only copy `src/autorevision.h` in if there have been changes.
{'fraction_non_alphanumeric': 0.18225217635495647, 'fraction_numerical': 0.0005616399887672002, 'mean_word_length': 4.230543318649046, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7284097', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1312, 'n_words': 420}