diff options
author | yoctocell <public@yoctocell.xyz> | 2021-01-03 21:17:55 +0100 |
---|---|---|
committer | yoctocell <public@yoctocell.xyz> | 2021-01-03 21:19:38 +0100 |
commit | df23c5cbf295fb7f2441e2fe60ece14bab3df001 (patch) | |
tree | 2c10c896b43774b7b83706569873b5787ced58b6 | |
parent | 269ad9e6b4c9f81d0801d5c793a6fcf20b20fbfc (diff) |
Add fail-safe for extracting header
Some patches don't have the 'in-reply-to' header.
* git-email.el (git-email--extract-header): If the header is not found,
return an empty string.
-rw-r--r-- | git-email.el | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/git-email.el b/git-email.el index a66fd16..40588e5 100644 --- a/git-email.el +++ b/git-email.el @@ -50,12 +50,15 @@ :type 'symbol) (defun git-email--extract-header (header patch-file) - "Extract HEADER from PATCH-FILE." + "Extract HEADER from PATCH-FILE. +If the header is not found, return an empty string." (with-temp-buffer (insert-file-contents patch-file) (goto-char (point-min)) (buffer-substring-no-properties - (re-search-forward (format " *%s: +" header)) + (if (re-search-forward (format " *%s: +" header) nil t) + (point) + (point-at-eol)) (point-at-eol)))) (defun git-email--extract-diff (patch-file) |