From 7a30c775f5f6129e55b3f5c94efd72c114a9be87 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Mon, 8 Apr 2013 15:37:09 -0500 Subject: verify-commit: Misc improvements. - Fix line numbers in code. - Allow C++ :: token in commit messages as not a commit msg tag. Change-Id: I6f9ef6e09e3fac586ad87eac690074cb1eda32be Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3952 Reviewed-by: Brian H. Horton Tested-by: Jenkins Server Reviewed-by: ADAM R. MUHLE Reviewed-by: A. Patrick Williams III --- src/build/tools/verify-commit | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/build/tools/verify-commit') diff --git a/src/build/tools/verify-commit b/src/build/tools/verify-commit index 6341eb2c7..627f93c95 100755 --- a/src/build/tools/verify-commit +++ b/src/build/tools/verify-commit @@ -54,7 +54,8 @@ sub verifyPatchSet # * Show only the lines changed, with no context (U0). # Grep only the lines marked with "+" (instead of "-") to find just the # actions done by this patchset and not the content removed. - open PATCH_CONTENTS, "git diff HEAD~1 --diff-filter=AM -U0 | grep \"^+\" |"; + open PATCH_CONTENTS, "git diff HEAD~1 --diff-filter=AM -U0 | ". + "grep -e \"^+\" -e \"^@@.*+[0-9]\\+\" |"; my %fileContents = (); @@ -77,6 +78,12 @@ sub verifyPatchSet } $lastFile = $1; } + # Lines starting with "@@" indicates a seek in the file, so update + # line numbers. + elsif ($line =~ m/^@@.*\+([0-9]+)/) + { + $lineCount = $1 - 1; + } else { $line =~ s/^\+//; # filter off the leading + symbol. @@ -244,7 +251,7 @@ sub verifyCommitMsg # Identify if this is a tagged line or a non-tagged line and store # away. - if ($line =~ m/^\s*[A-Za-z0-9\-_]+:/) + if ($line =~ m/^\s*[A-Za-z0-9\-_]+:[^:]/) { # We allow lines that look like tags in the topic like... # "FOO: Adding support for BAR." -- cgit v1.2.1