yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
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 GMT
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 <aw@apache.org>


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 <caseyjbrotherton@gmail.com>
Authored: Sun Aug 21 21:36:14 2016 -0500
Committer: Allen Wittenauer <aw@apache.org>
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


Mime
View raw message