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

Perform supertree convert in staging on same filesystem

If the staging dir is on a different FS (likely if in /tmp) the various
'mv' operations become disk-heavy copy operations. This commit changes
the staging directory location to a temp location in the same directory
as the repo.
parent d7a2d810
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -109,9 +109,9 @@ warn() { { printf "WARNING: "; cat; } | info >&2; }

is_empty()
{
	declare -a files=( $1/* )
	[[ ${#files[*]} -eq 1 ]] &&
	[[ ${files[0]} -ef $1/.backup.tar ]] ||
	local IFS=$'\n'
	declare -a files=( $(find $1 -mindepth 1 -maxdepth 1 \
		-name .backup.tar -o -name '.stage.*' -o -print) )
	[[ ${#files[*]} -eq 0 ]]
}

@@ -317,12 +317,11 @@ action_convert()
	fi
	tar -cf .backup.tar ./*

	STAGE=$(mktemp -d)
	STAGE=$(mktemp -d $PWD/.stage.XXX)
	find -mindepth 1 -maxdepth 1 \
		-name .backup.tar \
		-name .backup.tar -o -name '.stage.*' \
		-o -exec mv '{}' "$STAGE"/ \;


	action_clone "$STAGE/.git" .

	# Replicate all original heads & remotes in new repo