Summary

      A commit message containing a string similar to a JIRA issue will incorrectly link to the issue. Specifically, a commit message that resembles a JIRA issue key with spaces in it.

      Environment

      FishEye/Crucible 4.2.0

      Steps to Reproduce

      1. Create an application link between FishEye and JIRA
      2. Create a project called NS
      3. Create an issue
      4. Commit a change in the repo using git commit -m "test commit *** XX ns - 1 ns ***"
      5. In Jira development panel we will see the commit

      Expected Results

      This commit shouldn't be visible in JIRA issue

      Notes

      Found those entries referencing to the "ns - 2" commit message

      2016-10-18 16:19:56,825 DEBUG [qtp131872530-296 ] com.atlassian.fecru.plugin.jira.summary.service.DefaultCommitDetailsService DefaultCommitDetailsService-lambda$getCommitDetails$0 - Changeset query is +(comment:"ns - 2" -comment:"- ns - 2" p4.job:ns-2) +doctype:1
      2016-10-18 16:19:56,830 DEBUG [qtp131872530-296 ] com.atlassian.fecru.plugin.jira.summary.service.DefaultCommitDetailsService DefaultCommitDetailsService-lambda$getCommitDetails$0 - Found 1 changeset docs in 1 repositories
      2016-10-18 16:19:56,872 DEBUG [qtp131872530-296 ] fisheye RepositoryHandle-acquire - acquire engine on Hello, count=1, waited 0 ms to acquire.
      2016-10-18 16:19:56,875 DEBUG [qtp131872530-296 ] fisheye RepositoryHandle-release - release engine on Hello, count=0 waited 0 ms to release
      2016-10-18 16:19:56,877 DEBUG [qtp131872530-296 ] fisheye ProfilingServletFilter-logRequest - end request in 71ms GET /rest/dev-status/1.0/details/repositories?globalId=NS-2 nosession 200 mem=2.946MB
      2016-10-18 16:19:57,108 DEBUG [Resource Monitor ] fisheye SystemResourceMonitor$MonitoringTask-run - tc=155, ofd=628, mfd=10240, fm=150547800, tm=541065216
      2016-10-18 16:20:01,135 DEBUG [Resource Monitor ] fisheye SystemResourceMonitor$MonitoringTask-run - tc=154, ofd=628, mfd=10240, fm=150474760, tm=541065216
      2016-10-18 16:20:03,020 DEBUG [notificationManager1 ] fisheye DefaultNotificationSender-lambda$sendNotifications$0 - Processing notifications
      
      2016-10-18 16:40:19,575 DEBUG [qtp131872530-317 ] com.atlassian.fecru.plugin.jira.summary.service.DefaultCommitDetailsService DefaultCommitDetailsService-lambda$getCommitDetails$0 - Changeset query is +(comment:"ns - 3" -comment:"- ns - 3" p4.job:ns-3) +doctype:1
      2016-10-18 16:40:19,644 DEBUG [qtp131872530-317 ] com.atlassian.fecru.plugin.jira.summary.service.DefaultCommitDetailsService DefaultCommitDetailsService-lambda$getCommitDetails$0 - Found 1 changeset docs in 1 repositories
      2016-10-18 16:40:19,681 DEBUG [qtp131872530-317 ] fisheye RepositoryHandle-acquire - acquire engine on Hello, count=2, waited 0 ms to acquire.
      2016-10-18 16:40:19,722 DEBUG [IncrPing1 Hello ] fisheye DvcsProcessMonitor-onAfterFinished - Finished process: git show-ref --heads --no-abbrev took 545ms
      2016-10-18 16:40:19,722 DEBUG [IncrPing1 Hello ] fisheye DvcsProcessMonitor-onBeforeStart - Starting process: git show-ref -d --tags
      2016-10-18 16:40:19,731 DEBUG [qtp131872530-317 ] fisheye RepositoryHandle-release - release engine on Hello, count=1 waited 0 ms to release
      

        1. commit_linked_issue.png
          commit_linked_issue.png
          82 kB
        2. Before_APP_LINK.png
          Before_APP_LINK.png
          86 kB
        3. After_APP_link.png
          After_APP_link.png
          111 kB

            [FE-6687] Jira issue development panel shows wrong commits

            Cezary Zawadka added a comment - - edited

            After HC discussion we agreed the issue is about linking from Jira development panel commits to FishEye. Activity streams or Fisheye pages doesn't seem to be affected.

            Cezary Zawadka added a comment - - edited After HC discussion we agreed the issue is about linking from Jira development panel commits to FishEye. Activity streams or Fisheye pages doesn't seem to be affected.

            Douglas Gnoato added a comment - - edited

            Hey czawadka@atlassian.com, sure thing, I can help you on that.

            So, I did the exact same thing you did, but I'm able to see it on JIRA's activity stream and on the issue details as well. I took some screen grabs to show you the behavior I'm having. Hope that helps.

            • JIRA's activity stream before app link

            • JIRA's activity stream after app link

             

            • Issue details

             

            I'm available for a screen share session any case you want to check it on my machine.

            Douglas Gnoato added a comment - - edited Hey czawadka@atlassian.com , sure thing, I can help you on that. So, I did the exact same thing you did, but I'm able to see it on JIRA's activity stream and on the issue details as well. I took some screen grabs to show you the behavior I'm having. Hope that helps. JIRA's activity stream before app link JIRA's activity stream after app link   Issue details   I'm available for a screen share session any case you want to check it on my machine.

            Cezary Zawadka added a comment - - edited

            dgnoato@atlassian.com, I tried to reproduce the problem with my local instance:

            • have jira project PA
            • jira and fisheye are linked
            • one commit "PA-1: ..." is linkified to jira
            • another commit "pa - 1: ..." isn't linked

            I see in JiraIssueUtil jira issue regex "(([A-Z][A-Z_0-9]{1,49})-
            d{1,9})" and we shouldn't match keys with spaces.

            Which screen should show link Jira issue? I can't see it on activity stream. Could you help us with that?

            Cezary Zawadka added a comment - - edited dgnoato@atlassian.com , I tried to reproduce the problem with my local instance: have jira project PA jira and fisheye are linked one commit "PA-1: ..." is linkified to jira another commit "pa - 1: ..." isn't linked I see in JiraIssueUtil jira issue regex "(( [A-Z] [A-Z_0-9] {1,49})- d{1,9})" and we shouldn't match keys with spaces. Which screen should show link Jira issue? I can't see it on activity stream. Could you help us with that?

            Daniel R added a comment - - edited

            This doc identified the following regex:
            https://confluence.atlassian.com/display/FISHEYE/Linking+FishEye+to+JIRA

            [a-zA-Z]{10}-[0-9]+

            This was incorrect based on two points:

            1. By default, JIRA project keys are upper case.
            2. By default, JIRA project keys must contain at least two characters.

            Reference: https://confluence.atlassian.com/display/AdminJIRAServer071/Changing+the+project+key+format

            I've since updated the document to reflect the JIRA defaults but are we intent on preserving the dual case regex for pattern matching?

            Daniel R added a comment - - edited This doc identified the following regex: https://confluence.atlassian.com/display/FISHEYE/Linking+FishEye+to+JIRA [a-zA-Z]{10}-[0-9]+ This was incorrect based on two points: By default, JIRA project keys are upper case. By default, JIRA project keys must contain at least two characters. Reference: https://confluence.atlassian.com/display/AdminJIRAServer071/Changing+the+project+key+format I've since updated the document to reflect the JIRA defaults but are we intent on preserving the dual case regex for pattern matching?

            Douglas Gnoato added a comment - - edited

            More information about the regex please refer to the comment below.

            https://jira.atlassian.com/browse/FE-4719?focusedCommentId=673242&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-673242

            Also, it's possible to test the regex on this page http://regexr.com

            Douglas Gnoato added a comment - - edited More information about the regex please refer to the comment below. https://jira.atlassian.com/browse/FE-4719?focusedCommentId=673242&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-673242 Also, it's possible to test the regex on this page http://regexr.com

              Unassigned Unassigned
              dgnoato@atlassian.com Douglas Gnoato
              Affected customers:
              7 This affects my team
              Watchers:
              11 Start watching this issue

                Created:
                Updated: