Adding 2 new functions:
* git_diff_to_head which prints the diff for the current new code
* match_file which searches and print a particular file that was
modified by the current code.
Signed-off-by: Sébastien Han <seb@redhat.com>
fi
}
-function test_sign_off {
- git fetch
+function git_diff_to_head {
# shellcheck disable=SC2154
# ghprbTargetBranch variable comes from jenkins's injectedEnvVars
+ git diff origin/"${ghprbTargetBranch}"..HEAD
+}
+
+function match_file {
+ git_diff_to_head | sed -n "s|^+++.*\\($1.*\\)|\\1|p"
+}
+
test "$(git log --oneline --no-merges origin/"${ghprbTargetBranch}"..HEAD | wc -l)" -ne "$(git log --no-merges origin/"${ghprbTargetBranch}"..HEAD | grep -c Signed-off-by)" && echo "One or more commits is/are missing a Signed-off-by. Add it with 'git commit -s'." && return 1
# if we arrive here the test command successed and we can return 0