# This file is used by gitpkg to extract a byte identical .orig.tar.gz
# file using pristine-tar.  To use it you need
# 1) pristine-tar, and to
# 2) configure HOOK_FILE=debian/gitpkg-hook.sh in gitpkg.conf (see man gitpkg for more info)
# 3) set REPO_ROOT, also gitpkg.conf
HOOK_PWD=$PWD
cd $REPO_ROOT
case $DEB_VERSION in
    *-*)
	if git show-ref pristine-tar 1>/dev/null; then
	    ORIGTGZ="${DEB_DIR}/${DEB_SOURCE}/${DEB_SOURCE}_${DEB_VERSION%-*}.orig.tar.gz"
	    echo pristine-tar checkout ${ORIGTGZ}
	    pristine-tar checkout ${ORIGTGZ}
	else
	    echo Not a pristine-tar repo, skipping
	fi
	;;
    *)
	echo "Native package, skipping pristine-tar"
	;;
esac
cd $HOOK_PWD
