aboutsummaryrefslogtreecommitdiff
path: root/scripts/git-log-pretty-since.sh
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-01-04 06:03:47 +0100
committerJustin M. Keyes <justinkz@gmail.com>2019-01-04 20:05:08 +0100
commit4e23f3e18017c619040263c99c8750bd5856c7a7 (patch)
tree0ac4e7019d1942722b011c5e4f535b32f8876e95 /scripts/git-log-pretty-since.sh
parent8b3113ce7a7e8d692c9aba8a256aa26b4c647203 (diff)
downloadrneovim-4e23f3e18017c619040263c99c8750bd5856c7a7.tar.gz
rneovim-4e23f3e18017c619040263c99c8750bd5856c7a7.tar.bz2
rneovim-4e23f3e18017c619040263c99c8750bd5856c7a7.zip
release.sh: Format issue-numbers in descriptions [ci skip]
Diffstat (limited to 'scripts/git-log-pretty-since.sh')
-rwxr-xr-xscripts/git-log-pretty-since.sh24
1 files changed, 22 insertions, 2 deletions
diff --git a/scripts/git-log-pretty-since.sh b/scripts/git-log-pretty-since.sh
index 529349d632..a0aa4354b6 100755
--- a/scripts/git-log-pretty-since.sh
+++ b/scripts/git-log-pretty-since.sh
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
-# Shows a log with changes grouped next to their merge-commit.
+# Prints a nicely-formatted commit history.
+# - Commits are grouped below their merge-commit.
+# - Issue numbers are moved next to the commit-id.
#
# Parameters:
# $1 "since" commit
@@ -19,6 +21,24 @@ is_merge_commit() {
git log $1^2 >/dev/null 2>&1 && return 0 || return 1
}
+# Removes parens from issue/ticket/PR numbers.
+#
+# Example:
+# in: 3340e08becbf foo (#9423)
+# out: 3340e08becbf foo #9423
+_deparen() {
+ sed 's/(\(\#[0-9]\{3,\}\))/\1/g'
+}
+
+# Cleans up issue/ticket/PR numbers in the commit descriptions.
+#
+# Example:
+# in: 3340e08becbf foo (#9423)
+# out: 3340e08becbf #9423 foo
+_format_ticketnums() {
+ nvim -Es +'g/\v(#[0-9]{3,})/norm! ngEldE0ep' +'%p' | _deparen
+}
+
for commit in $(git log --format='%H' --first-parent "$__SINCE"..HEAD); do
if is_merge_commit ${commit} ; then
if [ -z "$__INVMATCH" ] || ! git log --oneline ${commit}^1..${commit}^2 \
@@ -29,4 +49,4 @@ for commit in $(git log --format='%H' --first-parent "$__SINCE"..HEAD); do
else
git log -1 --oneline ${commit}
fi
-done
+done | _format_ticketnums