git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Signing by StGIT broken
@ 2008-01-10  2:53 Pavel Roskin
  2008-01-10  7:42 ` Karl Hasselström
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Roskin @ 2008-01-10  2:53 UTC (permalink / raw
  To: Karl Hasselström, Catalin Marinas; +Cc: git

Hello!

"stg edit --sign" is not working anymore.  It was working in version
0.14.

$ stg edit --sign
Checking for changes in the working directory ... done
Updating patch "id123" ... Traceback (most recent call last):
  File "/home/proski/bin/stg", line 43, in <module>
    main()
  File "home/proski/lib/python2.5/site-packages/stgit/main.py", line 278, in main
  File "home/proski/lib/python2.5/site-packages/stgit/commands/edit.py", line 235, in func
  File "home/proski/lib/python2.5/site-packages/stgit/commands/edit.py", line 93, in __update_patch
  File "home/proski/lib/python2.5/site-packages/stgit/commands/common.py", line 469, in parse_patch
  File "home/proski/lib/python2.5/site-packages/stgit/commands/common.py", line 359, in __split_descr_diff
AttributeError: 'NoneType' object has no attribute 'split'

git-bisect reports this:

a08e424021d32bf93ee7bb13ed0a9d7313367660 is first bad commit
commit a08e424021d32bf93ee7bb13ed0a9d7313367660
Author: Karl Hasselström <kha@treskal.com>
Date:   Thu Dec 13 00:13:55 2007 +0100

    Make generic --message/--file/--save-template flags
    
    And let "stg edit" use them.
    
    Signed-off-by: Karl Hasselström <kha@treskal.com>

:040000 040000 0c9317423123d328e8bf03866c08fa458808dce4 9195692410c3ed8171f2f799a8e3efd101a89a14 M      stgit


I suspect this part:

- elif options.file:
- __update_patch(pname, options.file, options)
+ elif any([options.message, options.authname, options.authemail,
+ options.authdate, options.commname, options.commemail,
+ options.sign_str]):
+ out.start('Updating patch "%s"' % pname)
+ __update_patch(pname, options.message, options)
+ out.done()

options.message is passed even if it's None and something else (like
options.sign_str) is defined.

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Signing by StGIT broken
  2008-01-10  2:53 Signing by StGIT broken Pavel Roskin
@ 2008-01-10  7:42 ` Karl Hasselström
  2008-01-12  4:58   ` Pavel Roskin
  0 siblings, 1 reply; 4+ messages in thread
From: Karl Hasselström @ 2008-01-10  7:42 UTC (permalink / raw
  To: Pavel Roskin; +Cc: Catalin Marinas, git

On 2008-01-09 21:53:16 -0500, Pavel Roskin wrote:

> "stg edit --sign" is not working anymore. It was working in version
> 0.14.

Thanks for the report and the detailed analysis. I'll write a test and
fix it (but not quite immediately, so feel free to beat me to it).

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Signing by StGIT broken
  2008-01-10  7:42 ` Karl Hasselström
@ 2008-01-12  4:58   ` Pavel Roskin
  2008-01-18  3:51     ` Karl Hasselström
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Roskin @ 2008-01-12  4:58 UTC (permalink / raw
  To: Karl Hasselström; +Cc: Catalin Marinas, git

On Thu, 2008-01-10 at 08:42 +0100, Karl Hasselström wrote:
> On 2008-01-09 21:53:16 -0500, Pavel Roskin wrote:
> 
> > "stg edit --sign" is not working anymore. It was working in version
> > 0.14.
> 
> Thanks for the report and the detailed analysis. I'll write a test and
> fix it (but not quite immediately, so feel free to beat me to it).

The fix below appears to work (thus making it a self-signing patch :))
but with my modest Python experience it absolutely needs to be reviewed.
I don't even know how to wrap the long line without making it look
misleading.

No testsuite fixes, sorry.  But the existing testsuite passes.


Fix "stg edit --sign"

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 stgit/commands/edit.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/stgit/commands/edit.py b/stgit/commands/edit.py
index b9699d5..650d5a3 100644
--- a/stgit/commands/edit.py
+++ b/stgit/commands/edit.py
@@ -90,7 +90,10 @@ def __update_patch(pname, text, options):
     bottom = patch.get_bottom()
     top = patch.get_top()
 
-    message, author_name, author_email, author_date, diff = parse_patch(text)
+    if text:
+        message, author_name, author_email, author_date, diff = parse_patch(text)
+    else:
+        message = author_name = author_email = author_date = diff = None
 
     out.start('Updating patch "%s"' % pname)
 

-- 
Regards,
Pavel Roskin

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Signing by StGIT broken
  2008-01-12  4:58   ` Pavel Roskin
@ 2008-01-18  3:51     ` Karl Hasselström
  0 siblings, 0 replies; 4+ messages in thread
From: Karl Hasselström @ 2008-01-18  3:51 UTC (permalink / raw
  To: Pavel Roskin; +Cc: Catalin Marinas, git

On 2008-01-11 23:58:03 -0500, Pavel Roskin wrote:

> On Thu, 2008-01-10 at 08:42 +0100, Karl Hasselström wrote:
>
> > On 2008-01-09 21:53:16 -0500, Pavel Roskin wrote:
> >
> > > "stg edit --sign" is not working anymore. It was working in version
> > > 0.14.
> >
> > Thanks for the report and the detailed analysis. I'll write a test
> > and fix it (but not quite immediately, so feel free to beat me to
> > it).
>
> The fix below appears to work (thus making it a self-signing patch
> :)) but with my modest Python experience it absolutely needs to be
> reviewed. I don't even know how to wrap the long line without making
> it look misleading.

It works by virtue of avoiding passing None to parse_patch(), which
expects a string object. So the fix is correct.

There are two ways to do line breaking in Python:

  1. Break the line between a pair of parentheses. That way, the
     parser knows that the line can't possibly end here:

       foo(1, 2, 3,
           4, 5, 6)

       x = { 'foo': 5,
             'bar': 17 }

  2. As a last resort, you can end a line with backslash:

       x = 1 + 2 + 3 \
           + 4 + 5 + 6

     But you should never use this. Insert a pair of otherwise
     redundant parentheses instead:

       x = (1 + 2 + 3
            + 4 + 5 + 6)

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-18  3:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-10  2:53 Signing by StGIT broken Pavel Roskin
2008-01-10  7:42 ` Karl Hasselström
2008-01-12  4:58   ` Pavel Roskin
2008-01-18  3:51     ` Karl Hasselström

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).