]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
git-issue: fix and speed up issue type lookup
authorMartin Willi <martin@revosec.ch>
Fri, 10 May 2013 16:30:23 +0000 (18:30 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 10 May 2013 16:49:34 +0000 (18:49 +0200)
scripts/git-issue

index 774c904297d4a2c45669877497d288acd9d48f97..a984f1b70334732434ce75642bf4b0ed4faf7c4d 100644 (file)
@@ -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
 }