threads / patch / 15508

patchAutosign newly created patches

Subject: [StGit PATCH] Autosign newly created patches

## tl;dr

4 messages between Sep 12, 2008 and Sep 15, 2008. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Catalin Marinas· Sep 12, 2008, 21:55 UTC · lore

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>
---

BTW, what happened to the patchdescr.tmpl file? It doesn't seem to be used anymore, however one can save a template file

 examples/gitconfig    |    3 +++
 stgit/commands/new.py |    8 +++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)
Show changes to 2 files +10 −1

examples/gitconfig, stgit/commands/new.py

diff --git a/examples/gitconfig b/examples/gitconfig
index 4a36202..9efc089 100644
--- a/examples/gitconfig
+++ b/examples/gitconfig
@@ -14,6 +14,9 @@
 	# 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
diff --git a/stgit/commands/new.py b/stgit/commands/new.py
index eb45e1b..4a58d52 100644
--- a/stgit/commands/new.py
+++ b/stgit/commands/new.py
@@ -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.config import config
 
 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:
+        sign_str = options.sign_str
+    else:
+        sign_str = config.get("stgit.autosign")
+
+    if sign_str != None:
         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:
Karl Hasselström· Sep 14, 2008, 08:37 UTC · re: Catalin Marinas · lore

Re: [StGit PATCH] Autosign newly created patches

On 2008-09-12 22:55:56 +0100, Catalin Marinas wrote:
> This patch adds the autosign configuration variable which is checked
> by the "new" command to automatically sign the patch message.

Sounds useful. I have a sign-off command in my .emacs, but I expect this would be useful for those who don't.

> BTW, what happened to the patchdescr.tmpl file? It doesn't seem to
> be used anymore, however one can save a template file

I don't know. I don't use it myself, so it's perfectly possible that I've broken it without noticing, seeing as there is no test suite coverage ...

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Catalin Marinas· Sep 14, 2008, 21:05 UTC · re: Karl Hasselström · lore

Re: [StGit PATCH] Autosign newly created patches

2008/9/14 Karl Hasselström <kha@treskal.com>:
Show 7 quoted lines
> On 2008-09-12 22:55:56 +0100, Catalin Marinas wrote:
>
>> This patch adds the autosign configuration variable which is checked
>> by the "new" command to automatically sign the patch message.
>
> Sounds useful. I have a sign-off command in my .emacs, but I expect
> this would be useful for those who don't.

I use emacs for writing code but not that much for stgit commands (I prefer the shell).

Show 6 quoted lines
>> BTW, what happened to the patchdescr.tmpl file? It doesn't seem to
>> be used anymore, however one can save a template file
>
> I don't know. I don't use it myself, so it's perfectly possible that
> I've broken it without noticing, seeing as there is no test suite
> coverage ...

There isn't a test but the command description suggests that patchdesr.tmpl file will be used if present.

Should we keep this feature? The only case where I was using it was for automatic signed-off-by line.

-- 
Catalin
Karl Hasselström· Sep 15, 2008, 07:43 UTC · re: Catalin Marinas · lore

Re: [StGit PATCH] Autosign newly created patches

On 2008-09-14 22:05:04 +0100, Catalin Marinas wrote:
Show 5 quoted lines
> There isn't a test but the command description suggests that
> patchdesr.tmpl file will be used if present.
>
> Should we keep this feature? The only case where I was using it was
> for automatic signed-off-by line.
I don't really have an opinion, as I don't use it.
-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

← back to recent threads