From 718f0c3dda9c9691d6e99821aca89a440d5075e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Guido=20G=C3=BCnther?= Date: Mon, 24 Oct 2011 09:48:00 +0200 Subject: [PATCH] gbp-pq: Strip .patch and .diff when importing patches without a subject --- gbp-pq | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gbp-pq b/gbp-pq index 3c22df9..1b04642 100755 --- a/gbp-pq +++ b/gbp-pq @@ -301,8 +301,13 @@ def apply_and_commit_patch(repo, patch, topic=None): """apply a single patch 'patch', add topic 'topic' and commit it""" header, body = get_mailinfo(patch) + # If we don't find a subject use the patch's name if not header.has_key('subject'): header['subject'] = os.path.basename(patch) + # Strip of .diff or .patch from patch name + base, ext = header['subject'].rsplit('.', 1) + if ext in [ 'diff', 'patch' ]: + header['subject'] = base if header.has_key('author') and header.has_key('email'): header['name'] = header['author'] -- 2.7.4