Commit 0c8537ef authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Use advanced stashing technique in submodule update

When updating submodules, handle the case where no changes were
stashed, so nothing should be unstashed.
parent ff780160
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@ get_shell()

update_submodules()
{
	git stash
	local stash=`git stash create`
	git reset --hard HEAD
	git submodule init
	git submodule sync
	git submodule update
@@ -83,7 +84,12 @@ update_submodules()
			  host:   `hostname -f`
		END_MESSAGE
	fi
	git stash pop
	if [ -n "$stash" ] && ! git stash apply $stash; then
		local msg="Submodule update: uncommited changes (unstash failed)"
		git stash store -m "$msg" $stash
		echo "Failed to unstash changes, the stash has been left on the " \
		     "stack. ($stash)" >&2
	fi
}

do_update()