rfc.sh: use 'git log -n1' instead of 'git show'

This is required mainly because if we use any format in a
documentation, and it has strings which are looking for commit
msg format (like fixes: bz...) in document, that too will be
considered in checks, even though it is not part of commit msg.

By using git log -n1, we would only check the content of commit
msg.

Updates: bz#1193929
Change-Id: I498590de6d3daa6be7bcbee1f083ef3fa6ecc96f
Signed-off-by: Amar Tumballi <amarts@redhat.com>
This commit is contained in:
Amar Tumballi 2018-09-05 09:10:39 +05:30 committed by Vijay Bellur
parent 515074156d
commit 77958023ff

8
rfc.sh
View File

@ -78,7 +78,7 @@ check_backport()
fi
# Extract the change ID from the commit message
changeid=$(git show --format='%b' | grep -i '^Change-Id: ' | awk '{print $2}')
changeid=$(git log -n1 --format='%b' | grep -i '^Change-Id: ' | awk '{print $2}')
# If there is no change ID ask if we should continue
if [ -z "$changeid" ]; then
@ -130,10 +130,10 @@ editor_mode()
if [ $(basename "$1") = "COMMIT_EDITMSG" ]; then
# see note above function warn_reference_missing for regex elaboration
# Lets first check for github issues
ref=$(git show --format='%b' | grep -ow -E "([fF][iI][xX][eE][sS]|[uU][pP][dD][aA][tT][eE][sS])(:)?[[:space:]]+(gluster\/glusterfs)?#[[:digit:]]+" | awk -F '#' '{print $2}');
ref=$(git log -n1 --format='%b' | grep -ow -E "([fF][iI][xX][eE][sS]|[uU][pP][dD][aA][tT][eE][sS])(:)?[[:space:]]+(gluster\/glusterfs)?#[[:digit:]]+" | awk -F '#' '{print $2}');
if [ "x${ref}" = "x" ]; then
# if not found, check for bugs
ref=$(git show --format='%b' | grep -ow -E "([fF][iI][xX][eE][sS]|[uU][pP][dD][aA][tT][eE][sS])(:)?[[:space:]]+bz#[[:digit:]]+" | awk -F '#' '{print $2}');
ref=$(git log -n1 --format='%b' | grep -ow -E "([fF][iI][xX][eE][sS]|[uU][pP][dD][aA][tT][eE][sS])(:)?[[:space:]]+bz#[[:digit:]]+" | awk -F '#' '{print $2}');
fi
if [ "x${ref}" != "x" ]; then
@ -312,7 +312,7 @@ main()
assert_diverge;
# see note above function warn_reference_missing for regex elaboration
reference=$(git show --format='%b' | grep -ow -E "([fF][iI][xX][eE][sS]|[uU][pP][dD][aA][tT][eE][sS])(:)?[[:space:]]+(gluster\/glusterfs)?(bz)?#[[:digit:]]+" | awk -F '#' '{print $2}');
reference=$(git log -n1 --format='%b' | grep -ow -E "([fF][iI][xX][eE][sS]|[uU][pP][dD][aA][tT][eE][sS])(:)?[[:space:]]+(gluster\/glusterfs)?(bz)?#[[:digit:]]+" | awk -F '#' '{print $2}');
# If this is a commit against master and does not have a bug ID or a github
# issue reference. Warn the contributor that one of the 2 is required