<commit_before>#!/bin/sh
#
# mkrevision.sh - generate revision headers from Git and Autoconf metadata
#
# Copyright (C) 2006-2007 Carnegie Mellon University
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.Eclipse.
# ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS SOFTWARE CONSTITUTES
# RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT
#

set -e

BASEDIR=`dirname $0`
REVFILE="$BASEDIR/.gitrevision"

if [ "$1" = "update" ] ; then
	if [ ! -d $BASEDIR/.git ] ; then
		exit 0
	fi

	REV=`git-describe`
	# Coda-specific workaround: different Coda clients may see different
	# stat information for the same files, which can cause a client to
	# believe the git index is not up-to-date, which could cause the
	# "-dirty" flag to be added against a clean repository.  So we
	# refresh the git index before checking it.
	git-update-index --refresh > /dev/null 2>&1 || true
	if git-diff-index HEAD | read junk ; then
		# There are uncommitted changes in the working copy
		REV="$REV-dirty"
	fi
	
	if [ -r $REVFILE ] ; then
		OLDREV=`cat $REVFILE`
	else
		OLDREV=""
	fi
	if [ "$REV" != "$OLDREV" ] ; then
		echo $REV > $BASEDIR/.gitrevision
	fi
	exit 0
fi

REV=`cat $REVFILE`
REL=`awk 'BEGIN { FS="\"" } /#define PACKAGE_VERSION/ { print $2 }' \
			$BASEDIR/config.h`
<commit_msg>mkrevision.sh: Don't fail if HEAD has no predecessor tags<commit_after>#!/bin/sh
#
# mkrevision.sh - generate revision headers from Git and Autoconf metadata
#
# Copyright (C) 2006-2007 Carnegie Mellon University
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.Eclipse.
# ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS SOFTWARE CONSTITUTES
# RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT
#

set -e

BASEDIR=`dirname $0`
REVFILE="$BASEDIR/.gitrevision"

if [ "$1" = "update" ] ; then
	if [ ! -d $BASEDIR/.git ] ; then
		exit 0
	fi

	# git describe will throw a fatal error if there is no predecessor
	# tag to the current commit
	REV=`git-describe 2>/dev/null || git-rev-parse --short HEAD`
	# Coda-specific workaround: different Coda clients may see different
	# stat information for the same files, which can cause a client to
	# believe the git index is not up-to-date, which could cause the
	# "-dirty" flag to be added against a clean repository.  So we
	# refresh the git index before checking it.
	git-update-index --refresh > /dev/null 2>&1 || true
	if git-diff-index HEAD | read junk ; then
		# There are uncommitted changes in the working copy
		REV="$REV-dirty"
	fi
	
	if [ -r $REVFILE ] ; then
		OLDREV=`cat $REVFILE`
	else
		OLDREV=""
	fi
	if [ "$REV" != "$OLDREV" ] ; then
		echo $REV > $BASEDIR/.gitrevision
	fi
	exit 0
fi

REV=`cat $REVFILE`
REL=`awk 'BEGIN { FS="\"" } /#define PACKAGE_VERSION/ { print $2 }' \
			$BASEDIR/config.h`

{'fraction_non_alphanumeric': 0.1095320623916811, 'fraction_numerical': 0.012131715771230503, 'mean_word_length': 3.625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '1299335', 'n_tokens_mistral': 1054, 'n_tokens_neox': 977, 'n_words': 369}