aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2019-05-05 22:51:14 +0300
committerJuri Linkov2019-05-05 22:51:14 +0300
commit4bfde2a79046519815e2bb8a8eb72e22eca0641f (patch)
tree450f5c291621bd8b32a813e92595e1c21d13ca74
parent7bba702e1ad1ed343618e44cf5bbc2a1f079be0c (diff)
downloademacs-4bfde2a79046519815e2bb8a8eb72e22eca0641f.tar.gz
emacs-4bfde2a79046519815e2bb8a8eb72e22eca0641f.zip
* lisp/vc/ediff-ptch.el (ediff-fixup-patch-map): Remove Git prefixes.
Strip possible source/destination prefixes such as a/ and b/ from directory names. (Bug#35420) (ediff-fixup-patch-map, ediff-dispatch-file-patching-job) (ediff-patch-file-internal): Replace string-match with string-match-p.
-rw-r--r--lisp/vc/ediff-ptch.el31
1 files changed, 22 insertions, 9 deletions
diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
index 4178b5a8c05..70c03b5c013 100644
--- a/lisp/vc/ediff-ptch.el
+++ b/lisp/vc/ediff-ptch.el
@@ -297,11 +297,24 @@ program."
297 ;; file names. This is a heuristic intended to improve guessing 297 ;; file names. This is a heuristic intended to improve guessing
298 (let ((default-directory (file-name-directory filename))) 298 (let ((default-directory (file-name-directory filename)))
299 (unless (or (file-name-absolute-p base-dir1) 299 (unless (or (file-name-absolute-p base-dir1)
300 (file-name-absolute-p base-dir2) 300 (file-name-absolute-p base-dir2))
301 (not (file-exists-p base-dir1)) 301 (if (and (file-exists-p base-dir1)
302 (not (file-exists-p base-dir2))) 302 (file-exists-p base-dir2))
303 (setq base-dir1 "" 303 (setq base-dir1 ""
304 base-dir2 ""))) 304 base-dir2 "")
305 ;; Strip possible source/destination prefixes
306 ;; such as a/ and b/ from dir names.
307 (save-match-data
308 (let ((m1 (when (string-match "^[^/]+/" base-dir1)
309 (cons (substring base-dir1 0 (match-end 0))
310 (substring base-dir1 (match-end 0)))))
311 (m2 (when (string-match "^[^/]+/" base-dir2)
312 (cons (substring base-dir2 0 (match-end 0))
313 (substring base-dir2 (match-end 0))))))
314 (when (and (file-exists-p (cdr m1))
315 (file-exists-p (cdr m2)))
316 (setq base-dir1 (car m1)
317 base-dir2 (car m2))))))))
305 (or (string= (car proposed-file-names) "/dev/null") 318 (or (string= (car proposed-file-names) "/dev/null")
306 (setcar proposed-file-names 319 (setcar proposed-file-names
307 (ediff-file-name-sans-prefix 320 (ediff-file-name-sans-prefix
@@ -325,8 +338,8 @@ program."
325 (mapc (lambda (session-info) 338 (mapc (lambda (session-info)
326 (let ((proposed-file-names 339 (let ((proposed-file-names
327 (ediff-get-session-objA-name session-info))) 340 (ediff-get-session-objA-name session-info)))
328 (if (and (string-match "^/null/" (car proposed-file-names)) 341 (if (and (string-match-p "^/null/" (car proposed-file-names))
329 (string-match "^/null/" (cdr proposed-file-names))) 342 (string-match-p "^/null/" (cdr proposed-file-names)))
330 ;; couldn't intuit the file name to patch, so 343 ;; couldn't intuit the file name to patch, so
331 ;; something is amiss 344 ;; something is amiss
332 (progn 345 (progn
@@ -574,7 +587,7 @@ optional argument, then use it."
574 (ediff-patch-file-internal 587 (ediff-patch-file-internal
575 patch-buf 588 patch-buf
576 (if (and ediff-patch-map 589 (if (and ediff-patch-map
577 (not (string-match 590 (not (string-match-p
578 "^/dev/null" 591 "^/dev/null"
579 ;; this is the file to patch 592 ;; this is the file to patch
580 (ediff-get-session-objA-name (car ediff-patch-map)))) 593 (ediff-get-session-objA-name (car ediff-patch-map))))
@@ -677,7 +690,7 @@ optional argument, then use it."
677 target-buf buf-to-patch file-name-magic-p 690 target-buf buf-to-patch file-name-magic-p
678 patch-return-code ctl-buf backup-style aux-wind) 691 patch-return-code ctl-buf backup-style aux-wind)
679 692
680 (if (string-match "V" ediff-patch-options) 693 (if (string-match-p "V" ediff-patch-options)
681 (error 694 (error
682 "Ediff doesn't take the -V option in `ediff-patch-options'--sorry")) 695 "Ediff doesn't take the -V option in `ediff-patch-options'--sorry"))
683 696