[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/debbugs 11f53a4 251/311: Fix up patch file names that a
From: |
Stefan Monnier |
Subject: |
[elpa] externals/debbugs 11f53a4 251/311: Fix up patch file names that are absolute |
Date: |
Sun, 29 Nov 2020 18:42:23 -0500 (EST) |
branch: externals/debbugs
commit 11f53a470b100a6b0f683e9d300c5c9e3fac4140
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Fix up patch file names that are absolute
---
debbugs-gnu.el | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index 840b256..b77a5c2 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -2232,29 +2232,38 @@ If given a prefix, patch in the branch directory
instead."
(goto-char (point-min))
(while (re-search-forward diff-file-header-re nil t)
(goto-char (match-beginning 0))
- (let ((target-name (car (diff-hunk-file-names))))
- (when (and target-name
- (or (not (string-match "/" target-name))
- (and (string-match "^[ab]/" target-name)
- (not (file-exists-p
- (expand-file-name (substring target-name 2)
- dir))))
- (file-exists-p (expand-file-name target-name dir))))
+ (let ((target-name (cl-loop for name in (diff-hunk-file-names)
+ ;; The target names are usually actual
+ ;; file names, but they can also be
+ ;; things like "#<buffer eww.el>".
+ unless (string-match "[ #<>]" name)
+ return name)))
+ (when target-name
+ (when (string-match "^/" target-name)
+ ;; This is an absolute path, so try to find the target.
+ (while (and (search "/" target-name)
+ (not (file-exists-p (expand-file-name target-name dir))))
+ (setq target-name (replace-regexp-in-string "^[^/]*/" ""
+ target-name))))
+ ;; See whether we can find the file.
+ (when (or (not (string-match "/" target-name))
+ (and (string-match "^[ab]/" target-name)
+ (not (file-exists-p
+ (expand-file-name (substring target-name 2)
+ dir))))
+ (file-exists-p (expand-file-name target-name dir))))
;; We have a simple patch that refers to a file somewhere in the
;; tree. Find it.
(when-let ((files (directory-files-recursively
dir
(concat "^" (regexp-quote
(file-name-nondirectory target-name))
- "$"))))
- (when (re-search-forward (concat "^[+]+ "
- (regexp-quote target-name)
- "\\([ \t\n]\\)")
- nil t)
+ "$"))))
+ (when (re-search-forward "^[+]+ .*" nil t)
(replace-match (concat "+++ a"
(substring (car files) (length dir))
(match-string 1))
- nil t)))))
+ nil t))))))
(forward-line 2)))
(defun debbugs-gnu-find-contributor (string)
- [elpa] externals/debbugs 23a4b78 203/311: Get the correct patch author name, (continued)
- [elpa] externals/debbugs 23a4b78 203/311: Get the correct patch author name, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 94e859e 219/311: debbugs: Handle Emacs with separate build number, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs a762b83 223/311: Set mouse point in debbugs, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs d8e0199 226/311: Tweak minor problem in debbugs.el, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 3aa755c 224/311: ; Add debbugs-gnu.el TODO item, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 705125d 228/311: Bump debbugs 0.15, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs efa391d 234/311: Add mail command index in debbugs, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 9893851 237/311: * packages/debbugs/debbugs-ug.texi (Control Messages): Fix typos., Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 03e8ba4 249/311: * debbugs: Cosmetic changes, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 32fedac 250/311: * packages/debbugs/debbugs.el: Increase Version to 0.18., Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 11f53a4 251/311: Fix up patch file names that are absolute,
Stefan Monnier <=
- [elpa] externals/debbugs f30cee8 252/311: Fix syntax error in previous patch., Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs fa1a2d2 255/311: Only fix up the file if it really exists, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 7f6186e 260/311: Also accept octet parts in debbugs-gnu patches, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs d0d2ce3 266/311: Correctly parse non-ascii names in debbugs-gnu, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 87708cd 265/311: * packages/debbugs/debbugs-gnu.el (debbugs-gnu, debbugs-gnu-bugs): Send final, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 131a4a9 267/311: Release debbugs 0.20, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 112f78c 274/311: Fix leftover oddities in debbugs, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 2ceb7cd 288/311: Don't cache the debbugs directory but allow setting it per invocation, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 38ae622 307/311: Remove blank header line in debbugs-gnu.el, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 43b142a 305/311: Declare variables in debbugs-gnu.el, Stefan Monnier, 2020/11/29