From 952200044d4078cbc5f45e4cd9228347c57e80b9 Mon Sep 17 00:00:00 2001 From: RoToRx88 Date: Tue, 26 Jun 2018 15:19:22 +0200 Subject: [PATCH] Better support for branch name Enable to get issue from branch prefixed with it and delimited by '_' --- plugins/jira/jira.plugin.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 13de0f437..9e7cf2b88 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -65,7 +65,12 @@ function jira() { # but `branch` is a special case that will parse the current git branch if [[ "$action" == "branch" ]]; then local issue_arg=$(git rev-parse --abbrev-ref HEAD) - local issue="${jira_prefix}${issue_arg}" + issue_arg=($(echo $issue_arg | cut -d'_' -f1)) + if [[ $(echo ${issue_arg} | grep ${jira_prefix}) ]]; then + local issue="${issue_arg}" + else + local issue="${jira_prefix}${issue_arg}" + fi else local issue_arg=${(U)action} local issue="${jira_prefix}${issue_arg}"