diff options
author | Ferry Huberts | 2011-07-18 12:45:20 +0200 |
---|---|---|
committer | Lars Hjemli | 2011-07-19 07:12:02 +0000 |
commit | afdff8dc1327ed14c94cf447272191bd28009ed1 (patch) | |
tree | 54278d96e6216d24fa08d21f5e830a75436f363a | |
parent | Merge branch 'stable' (diff) | |
download | cgit-afdff8dc1327ed14c94cf447272191bd28009ed1.tar.gz cgit-afdff8dc1327ed14c94cf447272191bd28009ed1.zip |
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>
-rwxr-xr-x | filters/commit-links.sh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/filters/commit-links.sh b/filters/commit-links.sh index d2cd2b3..5881952 100755 --- a/filters/commit-links.sh +++ b/filters/commit-links.sh | |||
@@ -15,11 +15,14 @@ | |||
15 | # CGIT_REPO_CLONE_URL ( = repo.clone-url setting ) | 15 | # CGIT_REPO_CLONE_URL ( = repo.clone-url setting ) |
16 | # | 16 | # |
17 | 17 | ||
18 | regex='' | ||
19 | |||
18 | # This expression generates links to commits referenced by their SHA1. | 20 | # This expression generates links to commits referenced by their SHA1. |
19 | regex=$regex' | 21 | regex=$regex' |
20 | s|\b([0-9a-fA-F]{8,40})\b|<a href="./?id=\1">\1</a>|g' | 22 | s|\b([0-9a-fA-F]{7,40})\b|<a href="./?id=\1">\1</a>|g' |
23 | |||
21 | # This expression generates links to a fictional bugtracker. | 24 | # This expression generates links to a fictional bugtracker. |
22 | regex=$regex' | 25 | regex=$regex' |
23 | s| #([0-9]+)\b|<a href="http://bugs.example.com/?bug=\1">#\1</a>|g' | 26 | s|#([0-9]+)\b|<a href="http://bugs.example.com/?bug=\1">#\1</a>|g' |
24 | 27 | ||
25 | sed -re "$regex" | 28 | sed -re "$regex" |