quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH] quilt: add support for signing off patches


From: Pekka J Enberg
Subject: [Quilt-dev] [PATCH] quilt: add support for signing off patches
Date: Wed, 28 Mar 2007 13:28:14 -0000

From: Pekka Enberg <address@hidden>

This adds a new -s|--signoff option to the refresh command which adds
a proper Signed-off-by line to the patch before the patch description
separator.

Signed-off-by: Pekka Enberg <address@hidden>
---
 quilt/refresh.in |   45 +++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 41 insertions(+), 4 deletions(-)

Index: quilt/quilt/refresh.in
===================================================================
--- quilt.orig/quilt/refresh.in 2007-03-28 11:35:16.000000000 +0300
+++ quilt/quilt/refresh.in      2007-03-28 12:23:30.000000000 +0300
@@ -19,7 +19,7 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt refresh [-p n|-p ab] [-u|-U num|-c|-C num] 
[-z[new_name]] [-f] [--no-timestamps] [--no-index] [--diffstat] [--sort] 
[--backup] [--strip-trailing-whitespace] [patch]\n"
+       printf $"Usage: quilt refresh [-p n|-p ab] [-u|-U num|-c|-C num] 
[-z[new_name]] [-f] [--no-timestamps] [--no-index] [--diffstat] [--sort] 
[--backup] [--strip-trailing-whitespace] [-s|--signoff] [patch]\n"
 
        if [ x$1 = x-h ]
        then
@@ -71,6 +71,11 @@ -p n Create a -p n style patch (-p0 or -
 
 --strip-trailing-whitespace
        Strip trailing whitespace at the end of lines.
+
+-s|--signoff
+       Add Signed-off-by line to the commit message. Use QUILT_COMMITTER_NAME
+       and QUILT_COMMITTER_EMAIL environment variables to configure the
+       sign-off line.
 "
                exit 0
        else
@@ -87,9 +92,10 @@ die()
        exit $status
 }
 
-options=`getopt -o p:uU:cC:fz::h --long no-timestamps,diffstat,backup,sort \
-                                --long no-index \
-                                --long strip-trailing-whitespace -- "$@"`
+options=`getopt -o p:uU:cC:fz::hs --long no-timestamps,diffstat,backup,sort \
+                                 --long no-index \
+                                 --long signoff \
+                                 --long strip-trailing-whitespace -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -138,6 +144,12 @@ do
        --strip-trailing-whitespace)
                opt_strip_whitespace=1
                shift ;;
+       -s)
+               opt_signoff=1
+               shift ;;
+       --signoff)
+               opt_signoff=1
+               shift ;;
        --)
                shift
                break ;;
@@ -309,6 +321,31 @@ else
        > $tmp_result
 fi
 
+if [ -n "$opt_signoff" ]
+then
+       if [ -n "$QUILT_COMMITTER_NAME" ]
+       then
+               committer_name=$QUILT_COMMITTER_NAME
+       else
+               committer_name=`grep $USER /etc/passwd | cut -d: -f5`
+       fi
+
+       if [ -n "$QUILT_COMMITTER_EMAIL" ]
+       then
+               committer_email=$QUILT_COMMITTER_EMAIL
+       else
+               committer_email="address@hidden"
+       fi
+
+       signoff="Signed-off-by: $committer_name <$committer_email>"
+
+       grep -q "^$signoff$" $tmp_result
+       if [ $? -eq "1" ]
+       then
+               sed -i -e "s/^---$/$signoff\n---/g" $tmp_result
+       fi
+fi
+
 cat $tmp_patch >> $tmp_result
 
 mkdir -p $(dirname $patch_file)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]