[kernel-team] 41/47: Reorganise option parsing into while/case statements
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Mon Dec 21 00:30:52 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 3e87f021c96c7e0f001b1e11364953a52ba90a90
Author: Ben Hutchings <benh at debian.org>
Date: Sun May 17 18:38:36 2015 +0000
Reorganise option parsing into while/case statements
svn path=/people/benh/; revision=22653
---
scripts/benh/git-format-patch-for-debian | 62 +++++++++++++++++++-------------
1 file changed, 37 insertions(+), 25 deletions(-)
diff --git a/scripts/benh/git-format-patch-for-debian b/scripts/benh/git-format-patch-for-debian
index 339d6ce..9e69fba 100755
--- a/scripts/benh/git-format-patch-for-debian
+++ b/scripts/benh/git-format-patch-for-debian
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
-# Copyright 2010,2012,2013 Ben Hutchings
+# Copyright 2010,2012,2013,2015 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
@@ -18,34 +18,46 @@
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/"
- ;;
- http://sourceforge.net/p/*)
- export GIT_URL_BASE="$2/ci/"
+unset GIT_URL_BASE
+
+while [ $# -ge 1 ]; do
+ case "$1" in
+ --url)
+ 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/"
+ ;;
+ http://sourceforge.net/p/*)
+ export GIT_URL_BASE="$2/ci/"
+ ;;
+ http://git.infradead.org/*.git)
+ # Ugh. This is gitweb but the URL structure is different.
+ export GIT_URL_BASE="$2/commit/"
+ ;;
+ *)
+ echo >&2 "E: URL '$2' not recognised as gitweb, cgit, github or sourceforge"
+ exit 2
+ ;;
+ esac
+ shift 2
;;
- http://git.infradead.org/*.git)
- # Ugh. This is gitweb but the URL structure is different.
- export GIT_URL_BASE="$2/commit/"
+ --local)
+ export GIT_URL_BASE=
+ shift 1
;;
*)
- echo >&2 "E: URL '$2' not recognised as gitweb, cgit, github or sourceforge"
- exit 2
+ break
;;
esac
- shift 2
-elif [ "x$1" = x--local ]; then
- export GIT_URL_BASE=
- shift 1
-else
+done
+
+if [ ! -v GIT_URL_BASE ]; then
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/
--
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