add func for idempotent clone

Conflicts:
	lib.sh