From 772111be139c5065327786bed163a92dda12acb6 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Wed, 19 Dec 2007 09:25:18 +0000 Subject: [PATCH] (vc-ensure-vc-buffer): Avoid infinite looping when vc-parent-buffer is the current buffer. --- lisp/vc.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/vc.el b/lisp/vc.el index 9757161b7ad..7d843b934c5 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -1297,7 +1297,10 @@ Otherwise, throw an error." "Make sure that the current buffer visits a version-controlled file." (if vc-dired-mode (set-buffer (find-file-noselect (dired-get-filename))) - (while vc-parent-buffer + (while (and vc-parent-buffer + ;; Avoid infinite looping when vc-parent-buffer and + ;; current buffer are the same buffer. + (not (eq vc-parent-buffer (current-buffer)))) (set-buffer vc-parent-buffer)) (if (not buffer-file-name) (error "Buffer %s is not associated with a file" (buffer-name)) -- 2.39.2