Function: ediff-same-file-contents

ediff-same-file-contents is a byte-compiled function defined in ediff-diff.el.gz.

Signature

(ediff-same-file-contents F1 F2)

Documentation

Return t if files F1 and F2 have identical contents.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/ediff-diff.el.gz
(defun ediff-same-file-contents (f1 f2)
  "Return t if files F1 and F2 have identical contents."
  (if (and (not (file-directory-p f1))
           (not (file-directory-p f2)))
      (if (equal (file-remote-p f1) (file-remote-p f2))
	  (let ((res
		 ;; In the remote case, this works only if F1 and F2 are
		 ;; located on the same remote host.
		 (apply #'process-file ediff-cmp-program nil nil nil
			(append ediff-cmp-options
				(list (expand-file-name (file-local-name f1))
				      (expand-file-name (file-local-name f2)))))
		 ))
	    (and (numberp res) (eq res 0)))

	;; F1 and F2 are not located on the same host.
	(let ((t1 (file-local-copy f1))
	      (t2 (file-local-copy f2)))
	  (unwind-protect
	      (ediff-same-file-contents (or t1 f1) (or t2 f2))
	    (and t1 (delete-file t1))
	    (and t2 (delete-file t2))))
    )))