From mboxrd@z Thu Jan 1 00:00:00 1970 From: mailings at hupie.com (Ferry Huberts) Date: Thu, 23 Jun 2011 02:43:52 +0200 Subject: [PATCH v3 1/1] commit-links.sh: improve regular expressions In-Reply-To: <1308775583-22566-1-git-send-email-mailings@hupie.com> References: <1308775583-22566-1-git-send-email-mailings@hupie.com> Message-ID: <1308789832-13625-1-git-send-email-mailings@hupie.com> From: Ferry Huberts 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 --- 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 @@ # 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|\1|g' +s|\b([0-9a-fA-F]{7,40})\b|\1|g' + # This expression generates links to a fictional bugtracker. regex=$regex' -s| #([0-9]+)\b|#\1|g' +s|#([0-9]+)\b|#\1|g' sed -re "$regex" -- 1.7.5.4