#!/bin/sh
# checkin script for Git that serves to cause
# platforms/Cross/vm/sqSCCSVersion.h to be checked-in so that its version
# info reflects that of the current check-in.
#
# git add -A stages All
# git add . stages new and modified, without deleted
# git add -u stages modified and deleted, without new

echo "Have you checked incoming?  Y/n/check \c"
read n
case $n in
n|N|no|nO|No|NO)	exit 1;;
c|C|ch*|C[hH]*)		git remote update -p; git log ..@{u}; exit 0;;
esac

echo sanity checking generated files...

if [ "$1" = "-?" -o "$1" = -help -o "$1" = --help ]; then
	echo usage: $0 [git add args]
	echo e.g. $0 -u
	echo git add -A stages All\; This is the default
	echo git add . stages new and modified, without deleted
	echo git add -u stages modified and deleted, without new
	exit 0
fi

rm -rf src/plugins/[A-Z]*FFIPlugin
`dirname $0`/revertUnchangedPlugins src/plugins

if [ -n "`\`dirname $0\`/findUnofficialFiles`" ]; then
	echo the following files are generated from modified Monticello packages.
	`dirname $0`/findUnofficialFiles
	echo "Do you still want to check in?  y/N \c"
	read n
	case $n in
	"")					exit 1;;
	n|N|no|nO|No|NO)	exit 1;;
	esac
fi

# make sure that we enable our smudge and clean filters
# these replace occurences of $Rev$, $URL$, and $Date$ in
# locally checked out sqSCCSVersion.h and sqPluginsSCSSVersion.h
# with useful values
if [ -z "$@"  ]; then
    GIT_ARGS="-A"
else
    GIT_ARGS=$@
fi

git add $GIT_ARGS
# git reset HEAD -- platforms/Cross/plugins/*
# git reset HEAD -- platforms/win32/plugins/*
git commit

`dirname $0`/updateSCCSVersions
