9f31951019401449e057a236886d133f58c5cc64

Author
Alex <SendingMoreTrains@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix(jira): Make prefix check on "jira branch" command case-insensitive (#8799)

* Make prefix check on "jira branch" command case-insensitive

* Update plugins/jira/jira.plugin.zsh

Co-authored-by: Marc Cornellà <hello@mcornella.com>

* Fixing tabs to spaces

Co-authored-by: Robby Russell <robby@planetargon.com>
Co-authored-by: Marc Cornellà <hello@mcornella.com>

Diff

 1diff --git a/plugins/jira/README.md b/plugins/jira/README.md
 2index a5633af77c357eae2c4382ea626ce25eaf95b0b6..f8751aaa231c8ab571b05a813a3bec8ef7b086f6 100644
 3--- a/plugins/jira/README.md
 4+++ b/plugins/jira/README.md
 5@@ -27,6 +27,11 @@ jira branch     # opens an existing issue matching the current branch name
 6                 # The branch name may have prefixes ending in "/": "feature/MP-1234",
 7                 # and also suffixes starting with "_": "MP-1234_fix_dashboard"
 8                 # In both these cases, the issue opened will be "MP-1234"
 9+                # This is also checks if the prefix is in the name, and adds it if not, so:
10+                # "MP-1234" opens the issue "MP-1234",
11+                # "mp-1234" opens the issue "mp-1234",
12+                # and "1234" opens the issue "MP-1234".
13+# NOTE: since jira is case insensitive, the first two examples open the same issue
14 jira ABC-123    # opens an existing issue
15 jira ABC-123 m  # opens an existing issue for adding a comment
16 ```
17diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
18index 22807e0ae6c00aa0e055f2b3f6785a8ffb9d2fc1..37d7b6a27b6312eae7ae9550a9b752093268ca5b 100644
19--- a/plugins/jira/jira.plugin.zsh
20+++ b/plugins/jira/jira.plugin.zsh
21@@ -75,7 +75,7 @@ function jira() {
22       # Strip suffixes starting with _
23       issue_arg=(${(s:_:)issue_arg})
24       issue_arg=${issue_arg[1]}
25-      if [[ "$issue_arg" = ${jira_prefix}* ]]; then
26+      if [[ "${issue_arg:l}" = ${jira_prefix:l}* ]]; then
27         issue="${issue_arg}"
28       else
29         issue="${jira_prefix}${issue_arg}"