diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2023-10-12 23:14:00 -0400 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2023-10-22 16:09:05 -0400 |
commit | fb3707762de577074c73d40575fe759095ef83e6 (patch) | |
tree | b9819e0fe6d33906e0158c4e1e20d74fd1cd6e3a | |
parent | f44fa21c3ec1d9bf1b9da009e1c795942bf654eb (diff) | |
download | guix-fb3707762de577074c73d40575fe759095ef83e6.tar.gz guix-fb3707762de577074c73d40575fe759095ef83e6.zip |
etc: teams: Parse 'From' commit more leniently.
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.
Series-to: 66027@debbugs.gnu.org
Series-version: 3
Series-changes: 3
- New commit
Series-cc: Giovanni Biscuolo <g@xelera.eu>, Simon Tournier <zimon.toutoune@gmail.com>
Change-Id: I20400f87469ffb761ffc82dd32e34cd06f619043
-rw-r--r-- | etc/teams.scm.in | 13 |
1 files 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 @@ and REV-END, two git revision strings." 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." |