[kernel] r22654 - people/benh

Ben Hutchings benh at moszumanska.debian.org
Sun May 17 18:53:53 UTC 2015


Author: benh
Date: Sun May 17 18:53:53 2015
New Revision: 22654

Log:
Add --bug option to add bug URLs to the patch header

Modified:
   people/benh/git-format-patch-for-debian

Modified: people/benh/git-format-patch-for-debian
==============================================================================
--- people/benh/git-format-patch-for-debian	Sun May 17 18:38:36 2015	(r22653)
+++ people/benh/git-format-patch-for-debian	Sun May 17 18:53:53 2015	(r22654)
@@ -19,6 +19,7 @@
 set -e
 
 unset GIT_URL_BASE
+export BUG_URL_LIST=
 
 while [ $# -ge 1 ]; do
     case "$1" in
@@ -51,6 +52,22 @@
 	    export GIT_URL_BASE=
 	    shift 1
 	    ;;
+	--bug)
+	    case "$2" in
+		http*://*)
+		    bug_url="$2"
+		    ;;
+		[0-9]*)
+		    bug_url="https://bugs.debian.org/$2"
+		    ;;
+		*)
+		    echo >&2 "E: Bug '$2' not recognised as URL or number"
+		    exit 2
+		    ;;
+	    esac
+	    BUG_URL_LIST="$BUG_URL_LIST $bug_url"
+	    shift 2
+	    ;;
 	*)
 	    break
 	    ;;
@@ -66,13 +83,21 @@
 git format-patch --subject-prefix='' "$@" | while read name; do
     printf '%s\n' "$name"
     mv "$name" "$name".orig
-    awk 'FNR == 1 { hash = $2 }
+    awk 'BEGIN { split(ENVIRON["BUG_URL_LIST"], bug_urls) }
+FNR == 1 { hash = $2 }
 /^$/ && hash != "" {
     if (ENVIRON["GIT_URL_BASE"] != "") {
         print "Origin: " ENVIRON["GIT_URL_BASE"] hash
     } else {
         print "Forwarded: no"
     }
+    for (i in bug_urls) {
+       if (match(bug_urls[i], "^https?://bugs\\.debian\\.org/")) {
+           print "Bug-Debian: " bug_urls[i]
+       } else {
+           print "Bug: " bug_urls[i]
+       }
+    }
     hash = ""
 }
 FNR > 1 { print }' \



More information about the Kernel-svn-changes mailing list