Commit 7e2fb5f4 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Refactor submodule updating

This commit cleans up the submodule updating code and handles
git-checkout errors better.
parent 81b5de40
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -97,10 +97,12 @@ update_submodules()
	local stash=`git stash create`
	git reset --hard HEAD

	git submodule foreach 'git checkout origin/`
		git config -f ~/.gitmodules submodule.${name}.auto-update 2>/dev/null ||
			echo master`;
		cd $toplevel; git add $path'
	git submodule foreach '
		setting="submodule.${name}.auto-update";
		branch=`git config -f ~/.gitmodules ${setting}`;
		git checkout origin/${branch:-master} || exit 1
		cd ${toplevel};
		git add ${path}'
	local updates="`git status --short -uno`"
	if [ -n "$updates" ]; then
		git commit -F- <<-END_MESSAGE