#!/bin/sh
# Do commit --amend for all files in the repo

# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common

if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
	echo "gamend - do fast git commit amend (apply all current changes to the last commit)"
	echo "Use: gamend [-e] [file]"
	echo "     -e - edit commit message"
	exit 1
fi

#AMENDARG=" --date=\"$(date -R)\" -C HEAD"
AMENDARG=" --reset-author -C HEAD"
if [ "$1" = "-e" ] ; then
	AMENDARG=
	shift
fi

# If no args
if [ -z "$1" ] ; then
	AMENDARG="$AMENDARG -a"
fi

docmd git commit --amend $AMENDARG $@
