Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 75120200B6B for ; Thu, 25 Aug 2016 17:58:49 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7390B160AA5; Thu, 25 Aug 2016 15:58:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BC671160AA4 for ; Thu, 25 Aug 2016 17:58:48 +0200 (CEST) Received: (qmail 30232 invoked by uid 500); 25 Aug 2016 15:58:48 -0000 Mailing-List: contact commits-help@yetus.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@yetus.apache.org Delivered-To: mailing list commits@yetus.apache.org Received: (qmail 30223 invoked by uid 99); 25 Aug 2016 15:58:47 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Aug 2016 15:58:47 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 90CFDE0243; Thu, 25 Aug 2016 15:58:47 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aw@apache.org To: commits@yetus.apache.org Message-Id: <73b82b24369e4064ad35ce614313f12e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: yetus git commit: YETUS-443. github pull request regular expression in the jira plugin should be more complete Date: Thu, 25 Aug 2016 15:58:47 +0000 (UTC) archived-at: Thu, 25 Aug 2016 15:58:49 -0000 Repository: yetus Updated Branches: refs/heads/master d73c0e17c -> 0223ebf82 YETUS-443. github pull request regular expression in the jira plugin should be more complete Signed-off-by: Allen Wittenauer Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/0223ebf8 Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/0223ebf8 Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/0223ebf8 Branch: refs/heads/master Commit: 0223ebf82da8dc8c88f62678cab86e819d816038 Parents: d73c0e1 Author: Casey J. Brotherton Authored: Sun Aug 21 21:36:14 2016 -0500 Committer: Allen Wittenauer Committed: Thu Aug 25 08:58:40 2016 -0700 ---------------------------------------------------------------------- precommit/test-patch.d/github.sh | 15 +++++++++++---- precommit/test-patch.d/jira.sh | 8 +++----- 2 files changed, 14 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/0223ebf8/precommit/test-patch.d/github.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/github.sh b/precommit/test-patch.d/github.sh index e4b1163..dfb9a88 100755 --- a/precommit/test-patch.d/github.sh +++ b/precommit/test-patch.d/github.sh @@ -77,6 +77,7 @@ function github_parse_args done } + ## @description this gets called when JIRA thinks this ## @description issue is just a pointer to github ## @description WARNING: Called from JIRA plugin! @@ -85,12 +86,18 @@ function github_jira_bridge declare fileloc=$1 declare urlfromjira - # we use this to prevent loops later on - GITHUB_BRIDGED=true - # the JIRA issue has already been downloaded. So let's find the URL. # shellcheck disable=SC2016 - urlfromjira=$(${AWK} "match(\$0,\"${GITHUB_BASE_URL}/[^ ]*patch\"){print substr(\$0,RSTART,RLENGTH)}" "${PATCH_DIR}/jira" | tail -1) + + urlfromjira=$(${AWK} "match(\$0,\"${GITHUB_BASE_URL}/[^ ]*patch[ &\\\"]\"){url=substr(\$0,RSTART,RLENGTH-1)} + END{if (url) print url}" "${PATCH_DIR}/jira" ) + if [[ -n $urlfromjira ]]; then + # This is currently the expected path, as github pull requests are not common + return 1 + fi + + # we use this to prevent loops later on + GITHUB_BRIDGED=true yetus_debug "github_jira_bridge: Checking url ${urlfromjira}" github_breakup_url "${urlfromjira}" github_locate_patch "${GITHUB_ISSUE}" "${fileloc}" http://git-wip-us.apache.org/repos/asf/yetus/blob/0223ebf8/precommit/test-patch.d/jira.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/jira.sh b/precommit/test-patch.d/jira.sh index 37024e8..89f5162 100755 --- a/precommit/test-patch.d/jira.sh +++ b/precommit/test-patch.d/jira.sh @@ -132,11 +132,9 @@ function jira_locate_patch return 1 fi - # if github is configured and we see what looks like a URL, - # check the github plugin to see if the URL is a patch or pull request - # before continuing further - if [[ -n "${GITHUB_BASE_URL}" - && $(${GREP} -c "${GITHUB_BASE_URL}"'[^ ]*patch' "${PATCH_DIR}/jira") != 0 ]]; then + # if github is configured check to see if there is a URL in the text + # that is a github patch file or pull request + if [[ -n "${GITHUB_BASE_URL}" ]]; then jira_determine_issue "${input}" github_jira_bridge "${fileloc}" if [[ $? -eq 0 ]]; then