GNU bug report logs - #66027
Add a feature to automatically close specified bug reports upon committing.

Previous Next

Package: mumi;

Reported by: Giovanni Biscuolo <g <at> xelera.eu>

Date: Sat, 16 Sep 2023 09:38:02 UTC

Owned by: Giovanni Biscuolo <g <at> xelera.eu>

Severity: wishlist

Tags: help, moreinfo, notabug

Full log


View this message in rfc822 format

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 66027 <at> debbugs.gnu.org
Cc: Giovanni Biscuolo <g <at> xelera.eu>, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: bug#66027: [PATCH v3 3/3] etc: teams: Parse 'From' commit more leniently.
Date: Thu, 12 Oct 2023 23:33:45 -0400
When a Change-Id is used, patman prepends a Message-Id field on the first line
of the patch, which broke the assumption that the 'From $commit' line must
appear on the first line.

* etc/teams.scm.in (git-patch->commit-id): Loop each line of the file until a
match is found.  Update doc.

Change-Id: I20400f87469ffb761ffc82dd32e34cd06f619043
---

Changes in v3:
 - New commit

 etc/teams.scm.in | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index 55242caad1..703d76fe8d 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -770,13 +770,16 @@ (define (diff-revisions rev-start rev-end)
     files))
 
 (define (git-patch->commit-id file)
-  "Parse the commit ID from the first line of FILE, a patch produced with git."
+  "Parse the commit ID from FILE, a patch produced with git."
   (call-with-input-file file
     (lambda (port)
-      (let ((m (string-match "^From ([0-9a-f]{40})" (read-line port))))
-        (unless m
-          (error "invalid patch file:" file))
-        (match:substring m 1)))))
+      (let loop ((line (read-line port)))
+        (when (eof-object? line)
+          (error "could not find 'from' commit in patch" file))
+        (let ((m (string-match "^From ([0-9a-f]{40})" line)))
+          (if m
+           (match:substring m 1)
+           (loop (read-line port))))))))
 
 (define (git-patch->revisions file)
   "Return the start and end revisions of FILE, a patch file produced with git."
-- 
2.41.0





This bug report was last modified 1 year and 125 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.