From 81ef51d69cab1d09a82b10ddecf03d8ead5ace27 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Fri, 10 May 2013 18:30:23 +0200 Subject: [PATCH] git-issue: fix and speed up issue type lookup --- scripts/git-issue | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/scripts/git-issue b/scripts/git-issue index 774c904297..a984f1b703 100644 --- a/scripts/git-issue +++ b/scripts/git-issue @@ -116,19 +116,22 @@ get_revstatus () issuetype= get_issuetype () { - issue=$1 - issuetype=`git show -s --format=format:%b "$issue" | \ - grep "^issue-type: " | awk '{print \$2}'` - for commit in `git rev-list --all --all-match \ - --grep "^issue-id: $issue " --grep "^issue-status: " $rev` + local issue=$1 + + # use status of last type update, if any + for update in `git rev-list -n1 --all --all-match \ + --grep "^issue-id: $issue " --grep "^issue-type: "` do - issuetype=`git show -s --format=format:%b $commit | \ - grep "^issue-status: " | awk '{print \$2}'` + issue="$update" done - if [ -z "$issuetype" ] + type=`git show -s --format=format:%b $issue | grep "^issue-type: "` + + if [ -n "$type" ] then - revstatus="unknown" + issuetype=${type:12} + else + issuetype="unknown" fi } -- 2.47.2