#!/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 "gitcam - do fast git commit amend (apply all current changes to the last commit)"
	echo "Use: gitcam [-e] [file]"
	echo "     -e - edit commit message"
	exit 1
fi

AMENDARG="-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 $@
