+case "$cmd" in
+ release|release-*)
+ export LC_ALL=C
+
+ release_args="$cmd $*"
+ msg "*** $release_args: start"
+ release_starttime=`date +%s`
+ release_end()
+ {
+ release_endtime=`date +%s`
+ release_deltatime=$(($release_endtime - $release_starttime))
+ msg "*** $release_args: $release_deltatime seconds"
+ }
+ trap release_end EXIT
+ release_tempstarttime=$release_starttime
+ release_timereport()
+ {
+ release_endtime=`date +%s` # RELEASE NOW!!!
+ if [ -n "$*" ]; then
+ release_deltatime=$(($release_endtime - $release_tempstarttime))
+ msg "**** $release_args: $*: $release_deltatime seconds"
+ fi
+ release_tempstarttime=$release_endtime
+ }
+ release_git_extract_dir()
+ {
+ release_src=$1; shift
+ release_dst=$1; shift
+ # try to create a hardlink
+ if ln -f "$release_src/.git/HEAD" "$release_dst/.hardlink-test"; then
+ rm -f "$release_dst/.hardlink-test"
+ {
+ verbose cd "$release_src"
+ git ls-files HEAD -- "$@"
+ } | {
+ while IFS= read -r F; do
+ case "$F" in */*) mkdir -p "$release_dst/${F%/*}" ;; esac
+ verbose ln -f "$release_src/$F" "$release_dst/$F"
+ done
+ }
+ else
+ {
+ verbose cd "$release_src"
+ verbose git archive --format=tar HEAD -- "$@"
+ } | {
+ verbose cd "$release_dst"
+ verbose tar xvf -
+ }
+ fi
+ }
+ ;;
+esac
+