update-hook: abort early if the project description is unset
[gitweb.git] / templates / hooks--update
index 5b82b68e93980924befa9ecc99e099e77da27b5f..1a60773890cfcbaa5727636e6eda8280feb23bc1 100644 (file)
@@ -56,6 +56,12 @@ recipients=$(git-repo-config hooks.mailinglist)
 announcerecipients=$(git-repo-config hooks.announcelist)
 allowunannotated=$(git-repo-config --bool hooks.allowunannotated)
 
+# check for no description
+if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit this file to name it for gitweb" ]; then
+       echo "*** Project description file hasn't been set" >&2
+       exit 1
+fi
+
 # --- Check types
 newrev_type=$(git-cat-file -t $newrev)
 
@@ -210,7 +216,7 @@ case "$refname_type" in
                fi
 
                # If this tag succeeds another, then show which tag it replaces
-               prevtag=$(git describe $newrev^ 2>/dev/null | sed 's/-g.*//')
+               prevtag=$(git describe --abbrev=0 $newrev^ 2>/dev/null)
                if [ -n "$prevtag" ]; then
                        echo "  replaces  $prevtag"
                fi