Commit f968a31c authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Merge branch 'hotfix/0.1.4' into develop

parents 01c61981 91dbbaf6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

AC_INIT([git-hooks], [0.1.3])
AC_INIT([git-hooks], [0.1.4])
AM_INIT_AUTOMAKE

gitcoredir=`git --exec-path`
+30 −21
Original line number Diff line number Diff line
#! /bin/bash

config ()
{
	git config --get auto-build`printf ".%s" "$@"`
}
config () { git config --get auto-build`printf ".%s" "$@"`; }
config-all () { git config --get-all auto-build`printf ".%s" "$@"`; }

profile ()
{
@@ -93,7 +91,7 @@ _get_config_section ()
		echo "Finding match for $1 in"
		printf "  %s\n" "${sections[@]}"
	} >&2
	for prefix in '' heads/ tags/ refs/ refs/heads/ refs/tags/; do
	for prefix in refs/tags/ refs/heads/ refs/ heads/ tags/ ''; do
		for sec in "${sections[@]}"; do
			case "$1" in
				$prefix$sec)
@@ -209,22 +207,32 @@ build ()
	cd "$dir"
	(
		unset GIT_DIR
		remote_ref="${ref/heads/remotes/origin}"
		git fetch origin
		git checkout -B "${ref/heads\//}" "${ref/heads/remotes/origin}"
		git fetch origin --tags
		case "${ref%%/*}" in
			heads)
				git checkout -B "${ref/heads\//}" "$remote_ref"
				;;
			*)
				git checkout -B build/ref/"$ref" "$remote_ref"
				;;
		esac
		git clean -f -d -q -x
		git reset --hard
	)

	# get the settings for this build
	profile=`config "$confsec" profile || determine_profile`
	cmd=`config "$confsec" command || profile "$profile" build`
	pattern=`config "$confsec" pattern || profile "$profile" pattern`
	replace_cmd=`profile "$profile" replace_cmd`
	backup=`config "$confsec" backup | tr '[:upper:]' '[:lower:]' || echo yes`

	IFS=$'\n' cmds=( `config-all "$confsec" command || profile "$profile" build` )
	for cmd in "${cmds[@]}"; do
		# normalise $cmd
		pushd "$GIT_DIR" >/dev/null
	eval cmd=( $cmd )
		eval "cmd=( $cmd )"
		cmd[0]=`readlink -e "${cmd[0]}" || echo "${cmd[0]}"`
		popd >/dev/null

@@ -237,6 +245,7 @@ build ()
				return 1
			fi
		)
	done

	# find the generated files
	pattern=`$replace_cmd "$pattern"`