diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-04-24 02:00:39 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-04-24 21:46:09 -0400 |
commit | 4f5a18237bac079ca64993ec7bf6b98eca0013a5 (patch) | |
tree | 271e6ea0e76cb372cd03bd829c68bd081ae42bf6 /scripts/git-log-pretty-since.sh | |
parent | ab63f5d93436094393b0d42d36b69b28e87252f6 (diff) | |
download | rneovim-4f5a18237bac079ca64993ec7bf6b98eca0013a5.tar.gz rneovim-4f5a18237bac079ca64993ec7bf6b98eca0013a5.tar.bz2 rneovim-4f5a18237bac079ca64993ec7bf6b98eca0013a5.zip |
release.sh: Automate release process.
Diffstat (limited to 'scripts/git-log-pretty-since.sh')
-rwxr-xr-x | scripts/git-log-pretty-since.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/git-log-pretty-since.sh b/scripts/git-log-pretty-since.sh new file mode 100755 index 0000000000..d8e3282fb3 --- /dev/null +++ b/scripts/git-log-pretty-since.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +# Shows a log with changes grouped next to their merge-commit. +# +# Parameters: +# $1 "since" commit +# $2 "inverse match" regex pattern + +set -e +set -u +set -o pipefail + +__SINCE=$1 +__INVMATCH=$2 + +is_merge_commit() { + git rev-parse $1 >/dev/null 2>&1 \ + || { echo "ERROR: invalid commit: $1"; exit 1; } + git log $1^2 >/dev/null 2>&1 && return 0 || return 1 +} + +for commit in $(git log --format='%H' --first-parent --since $__SINCE); do + if is_merge_commit ${commit} ; then + if [ -z "$__INVMATCH" ] || ! git log --oneline ${commit}^1..${commit}^2 \ + | grep -E "$__INVMATCH" >/dev/null 2>&1 ; then + git log -1 --oneline ${commit} + git log --format=' %h %s' ${commit}^1..${commit}^2 + fi + else + git log -1 --oneline ${commit} + fi +done |