chiark / gitweb /
Autosign newly created patches
authorCatalin Marinas <catalin.marinas@gmail.com>
Fri, 12 Sep 2008 21:22:47 +0000 (22:22 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Fri, 12 Sep 2008 21:22:47 +0000 (22:22 +0100)
This patch adds the autosign configuration variable which is checked by
the "new" command to automatically sign the patch message.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
examples/gitconfig
stgit/commands/new.py

index 4a362021860bac1293f240a4832cb844a7ed92cb..9efc0898eb01fa8e09f8b0acc6190482515a2b84 100644 (file)
@@ -14,6 +14,9 @@
        # Automatically Bcc the address below
        #autobcc = your.name@yourcompany.com
 
        # Automatically Bcc the address below
        #autobcc = your.name@yourcompany.com
 
+       # Automatically sign newly created patches
+       #autosign = Signed-off-by
+
        # Set to 'yes' if you don't want to use the 'resolved' command.
        # 'refresh' will automatically mark the conflicts as resolved
        #autoresolved = no
        # Set to 'yes' if you don't want to use the 'resolved' command.
        # 'refresh' will automatically mark the conflicts as resolved
        #autoresolved = no
index eb45e1b814085d1b5e3b8c6895100ec06eee1970..4a58d52ef1fdab23f4fe456d01e3313c56bb57c6 100644 (file)
@@ -21,6 +21,7 @@ from optparse import make_option
 from stgit import argparse, utils
 from stgit.commands import common
 from stgit.lib import git as gitlib, transaction
 from stgit import argparse, utils
 from stgit.commands import common
 from stgit.lib import git as gitlib, transaction
+from stgit.config import config
 
 help = 'create a new patch and make it the topmost one'
 usage = """%prog [options] [name]
 
 help = 'create a new patch and make it the topmost one'
 usage = """%prog [options] [name]
@@ -72,8 +73,13 @@ def func(parser, options, args):
 
     # Add Signed-off-by: or similar.
     if options.sign_str != None:
 
     # Add Signed-off-by: or similar.
     if options.sign_str != None:
+        sign_str = options.sign_str
+    else:
+        sign_str = config.get("stgit.autosign")
+
+    if sign_str != None:
         cd = cd.set_message(
         cd = cd.set_message(
-            utils.add_sign_line(cd.message, options.sign_str,
+            utils.add_sign_line(cd.message, sign_str,
                                 cd.committer.name, cd.committer.email))
 
     if options.save_template:
                                 cd.committer.name, cd.committer.email))
 
     if options.save_template: