1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-03 22:20:52 -08:00

* 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.
This commit is contained in:
Juri Linkov 2019-05-05 22:51:14 +03:00
parent 7bba702e1a
commit 4bfde2a790

View file

@ -297,11 +297,24 @@ program."
;; file names. This is a heuristic intended to improve guessing
(let ((default-directory (file-name-directory filename)))
(unless (or (file-name-absolute-p base-dir1)
(file-name-absolute-p base-dir2)
(not (file-exists-p base-dir1))
(not (file-exists-p base-dir2)))
(setq base-dir1 ""
base-dir2 "")))
(file-name-absolute-p base-dir2))
(if (and (file-exists-p base-dir1)
(file-exists-p base-dir2))
(setq base-dir1 ""
base-dir2 "")
;; Strip possible source/destination prefixes
;; such as a/ and b/ from dir names.
(save-match-data
(let ((m1 (when (string-match "^[^/]+/" base-dir1)
(cons (substring base-dir1 0 (match-end 0))
(substring base-dir1 (match-end 0)))))
(m2 (when (string-match "^[^/]+/" base-dir2)
(cons (substring base-dir2 0 (match-end 0))
(substring base-dir2 (match-end 0))))))
(when (and (file-exists-p (cdr m1))
(file-exists-p (cdr m2)))
(setq base-dir1 (car m1)
base-dir2 (car m2))))))))
(or (string= (car proposed-file-names) "/dev/null")
(setcar proposed-file-names
(ediff-file-name-sans-prefix
@ -325,8 +338,8 @@ program."
(mapc (lambda (session-info)
(let ((proposed-file-names
(ediff-get-session-objA-name session-info)))
(if (and (string-match "^/null/" (car proposed-file-names))
(string-match "^/null/" (cdr proposed-file-names)))
(if (and (string-match-p "^/null/" (car proposed-file-names))
(string-match-p "^/null/" (cdr proposed-file-names)))
;; couldn't intuit the file name to patch, so
;; something is amiss
(progn
@ -574,7 +587,7 @@ optional argument, then use it."
(ediff-patch-file-internal
patch-buf
(if (and ediff-patch-map
(not (string-match
(not (string-match-p
"^/dev/null"
;; this is the file to patch
(ediff-get-session-objA-name (car ediff-patch-map))))
@ -677,7 +690,7 @@ optional argument, then use it."
target-buf buf-to-patch file-name-magic-p
patch-return-code ctl-buf backup-style aux-wind)
(if (string-match "V" ediff-patch-options)
(if (string-match-p "V" ediff-patch-options)
(error
"Ediff doesn't take the -V option in `ediff-patch-options'--sorry"))