-# distinfo
-md5 $TARGET.tgz > $PORT/distinfo
-rmd160 $TARGET.tgz >> $PORT/distinfo
-sha1 $TARGET.tgz >> $PORT/distinfo
-cksum -a sha256 $TARGET.tgz >> $PORT/distinfo
-wc -c $TARGET.tgz 2>/dev/null | awk '{print "SIZE (" $2 ") = " $1}' >> $PORT/distinfo
+# commit and tag
+TAG="${PROJECT_UC}_${MAJOR}_${MINOR}_${PATCH}"
+git commit -am "Prepare for release ${PROJ_VER}." ||
+ report_err "unable to commit changes"
+git tag -a "$TAG" -m "Release ${PROJ_VER}" || report_err "unable to create tag"
+
+# create temp working space and copy repo over
+TD=$(mktemp -d /tmp/release.XXXXXXXXXX)
+if [ ! -d "$TD" ]; then
+ report_err "unable to create temp directory"
+fi
+RELEASE_DIR="$PROJECT-$PROJ_VER"
+RELEASE_TAR="$PROJECT-$PROJ_VER.tgz"
+git clone . "$TD/$RELEASE_DIR" ||
+ report_err "unable to copy to $TD/$RELEASE_DIR"
+
+# cleanup repository files
+cd "$TD"
+if [ -d "$RELEASE_DIR" -a -d "$RELEASE_DIR/.git" ]; then
+ rm -rf "$RELEASE_DIR/.git"
+fi
+if [ -d "$RELEASE_DIR" -a -f "$RELEASE_DIR/.gitignore" ]; then
+ rm -f "$RELEASE_DIR/.gitignore"
+fi