[kernel-team] 29/47: git-format-patch-for-debian: Generate DEP-3 Origin header field

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Mon Dec 21 00:30:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch master
in repository kernel-team.

commit ceb565633974444917fe2383b09714f14a68a950
Author: Ben Hutchings <benh at debian.org>
Date:   Mon Jul 1 05:10:35 2013 +0000

    git-format-patch-for-debian: Generate DEP-3 Origin header field
    
    Instead of prepending 'commit ... upstream.' to the patch description,
    generate an Origin header field.
    
    The Origin URL is supposed to refer to something accesible in a web
    browser.  Assume by default that the patch is in Linus's repository
    and generate a URL accordingly, but provide a --url option which
    specifies the web URL for the VCS web view.  Try to recognise which
    viewer it is (gitweb, cgit or github) and generate the URL for each
    commit accordingly.
    
    svn path=/people/benh/; revision=20317
---
 scripts/benh/git-format-patch-for-debian | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/scripts/benh/git-format-patch-for-debian b/scripts/benh/git-format-patch-for-debian
index bfa0aee..a2bb4b0 100755
--- a/scripts/benh/git-format-patch-for-debian
+++ b/scripts/benh/git-format-patch-for-debian
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright 2010,2012 Ben Hutchings
+# Copyright 2010,2012,2013 Ben Hutchings
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -17,12 +17,36 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 set -e
+
+if [ "x$1" = x--url ]; then
+    case "$2" in
+	http*/gitweb\?p=* | */\?p=*)
+	    export GIT_URL_BASE="$2;a=commit;h="
+	    ;;
+	http*/cgit/*)
+	    export GIT_URL_BASE="$2/commit?id="
+	    ;;
+	https://github.com/*)
+	    export GIT_URL_BASE="$2/commit/"
+	    ;;
+	*)
+	    echo >&2 "E: URL '$2' not recognised as gitweb, cgit or github"
+	    exit 2
+	    ;;
+    esac
+    shift 2
+else
+    echo >&2 "I: Assuming this patch is in Linus's tree."
+    echo >&2 "I: If not, use the --url option to specify the git web URL."
+    export GIT_URL_BASE=https://git.kernel.org/linus/
+fi
+
 git format-patch --subject-prefix='' "$@" | while read name; do
     printf '%s\n' "$name"
     mv "$name" "$name".orig
     awk 'FNR == 1 { hash = $2 }
-FNR > 1 { print }
-/^$/ && hash != "" { print "commit", hash, "upstream."; print; hash = "" }' \
+/^$/ && hash != "" { print "Origin: " ENVIRON["GIT_URL_BASE"] hash; hash = "" }
+FNR > 1 { print }' \
         "$name".orig > "$name"
     rm "$name".orig
 done

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/kernel-team.git



More information about the Kernel-svn-changes mailing list