mirror of
https://git.zx2c4.com/cgit
synced 2024-12-27 09:31:52 +00:00
commit-links.sh: improve regular expressions
The default length for sha1 abbreviations in git is 7. A '#num' at the beginning of the commit message is now recognised, a ':#num' as well, etc.: a '#num' anywhere is now converted to a link. Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
parent
b0d72da028
commit
afdff8dc13
@ -15,11 +15,14 @@
|
||||
# CGIT_REPO_CLONE_URL ( = repo.clone-url setting )
|
||||
#
|
||||
|
||||
regex=''
|
||||
|
||||
# This expression generates links to commits referenced by their SHA1.
|
||||
regex=$regex'
|
||||
s|\b([0-9a-fA-F]{8,40})\b|<a href="./?id=\1">\1</a>|g'
|
||||
s|\b([0-9a-fA-F]{7,40})\b|<a href="./?id=\1">\1</a>|g'
|
||||
|
||||
# This expression generates links to a fictional bugtracker.
|
||||
regex=$regex'
|
||||
s| #([0-9]+)\b|<a href="http://bugs.example.com/?bug=\1">#\1</a>|g'
|
||||
s|#([0-9]+)\b|<a href="http://bugs.example.com/?bug=\1">#\1</a>|g'
|
||||
|
||||
sed -re "$regex"
|
||||
|
Loading…
Reference in New Issue
Block a user