Repository: yetus Updated Branches: refs/heads/master 2113cfa87 -> 0f0c00cd1
YETUS-315. smart-apply-patch committer mode should support signed commits closes apache/yetus#11 Signed-off-by: Allen Wittenauer <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/0f0c00cd Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/0f0c00cd Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/0f0c00cd Branch: refs/heads/master Commit: 0f0c00cd1cc5117e183f317e2d36847397d8538a Parents: 2113cfa Author: Suraj Acharya <[email protected]> Authored: Wed Apr 5 22:29:17 2017 -0500 Committer: Allen Wittenauer <[email protected]> Committed: Mon Jun 26 11:31:11 2017 -0700 ---------------------------------------------------------------------- precommit/core.d/patchfiles.sh | 3 ++- precommit/smart-apply-patch.sh | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/0f0c00cd/precommit/core.d/patchfiles.sh ---------------------------------------------------------------------- diff --git a/precommit/core.d/patchfiles.sh b/precommit/core.d/patchfiles.sh index 2f54d67..90fb280 100755 --- a/precommit/core.d/patchfiles.sh +++ b/precommit/core.d/patchfiles.sh @@ -327,9 +327,10 @@ function patchcmd_apply function patchfile_apply_driver { declare patchfile=$1 + declare gpg=$2 if declare -f ${PATCH_METHOD}_apply >/dev/null; then - "${PATCH_METHOD}_apply" "${patchfile}" + "${PATCH_METHOD}_apply" "${patchfile}" "${gpg}" if [[ $? -gt 0 ]]; then return 1 fi http://git-wip-us.apache.org/repos/asf/yetus/blob/0f0c00cd/precommit/smart-apply-patch.sh ---------------------------------------------------------------------- diff --git a/precommit/smart-apply-patch.sh b/precommit/smart-apply-patch.sh index f43d945..2f9905d 100755 --- a/precommit/smart-apply-patch.sh +++ b/precommit/smart-apply-patch.sh @@ -102,6 +102,7 @@ function yetus_usage yetus_add_option "--skip-system-plugins" "Do not load plugins from ${BINDIR}/test-patch.d" yetus_add_option "--user-plugins=<dir>" "A directory of user provided plugins. see test-patch.d for examples (default empty)" yetus_add_option "--version" "Print release version information and exit" + yetus_add_option "--gpg-sign" "GPG sign the commit using gpg keys" yetus_generic_columnprinter "${YETUS_OPTION_USAGE[@]}" yetus_reset_usage @@ -153,6 +154,9 @@ function parse_args --committer) COMMITMODE=true ;; + --gpg-sign) + GPGSIGN=true + ;; --dry-run) PATCH_DRYRUNMODE=true ;; @@ -199,10 +203,15 @@ function gitam_dryrun function gitam_apply { declare patchfile=$1 + declare gpg=$2 + + if [[ ${gpg} = true ]]; then + EXTRA_ARGS="-S" + fi echo "Applying the patch:" yetus_run_and_redirect "${PATCH_DIR}/apply-patch-git-am.log" \ - "${GIT}" am --signoff --whitespace=fix "-p${PATCH_LEVEL}" "${patchfile}" + "${GIT}" am --signoff ${EXTRA_ARGS} --whitespace=fix "-p${PATCH_LEVEL}" "${patchfile}" ${GREP} -v "^Checking" "${PATCH_DIR}/apply-patch-git-am.log" } @@ -253,7 +262,7 @@ if [[ ${RESULT} -gt 0 ]]; then fi if [[ ${PATCH_DRYRUNMODE} == false ]]; then - patchfile_apply_driver "${PATCH_DIR}/patch" + patchfile_apply_driver "${PATCH_DIR}/patch" "${GPGSIGN}" RESULT=$? fi
