1
0
Fork 0

Added cref tag support to msgfmt, permitting ref of previous commits

master
Mike Gerwitz 2013-03-09 09:50:32 -05:00
parent a096f7ea19
commit e7fadb3513
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
2 changed files with 20 additions and 2 deletions

20
msgfmt
View File

@ -42,7 +42,25 @@ done
# format the commit message, stopping at the diff (if any) # format the commit message, stopping at the diff (if any)
awk '/^diff --git/ { exit } { print }' \ awk -vurl_root="$url_root" '
# replace commit refs with generated URL (allows linking to prior commits
# without hard-coding the configurable links that could change or be
# relative to where the content is hosted); this will then be processed as a
# normal URL by the remainder of the script
match($0, /\[cref:(.*?)\]/, g) {
# retrieve the URL from the hashcache and perform the line replacement
# (which will be reflected once we print the line)
c = "./hashcache " g[1]
c | getline result
gsub(/\[cref:.*?\]/, url_root result)
}
# stop printing at diff
/^diff --git/ { exit }
# otherwise, print everything
{ print }
' \
| sed ':a;N;$!ba; | sed ':a;N;$!ba;
# handle <>-delimited links (strip delimiters) # handle <>-delimited links (strip delimiters)
s#<\([fh]ttps\?://[^ ]\+\)>#\1#g; s#<\([fh]ttps\?://[^ ]\+\)>#\1#g;

View File

@ -76,7 +76,7 @@ license="${license:-$( cwarn license )}"
msgfmt="${msgfmt:-./msgfmt}" msgfmt="${msgfmt:-./msgfmt}"
# make configuration available to all scripts # make configuration available to all scripts
export title desc copyright license msgfmt export title desc copyright license msgfmt url_root
# pass commit list to the HTML and RSS processors # pass commit list to the HTML and RSS processors
"$repotype"/list | tee \ "$repotype"/list | tee \