From: Alexandre Julliard Date: Fri, 22 Dec 2006 13:56:15 GMT Subject: Re: [PATCH] fix vc git Message-ID: <87ac1guj9c.fsf@wine.dyndns.org> In-Reply-To: <8e745ecf0612220451v367479dq13af2d829a9547c2@mail.gmail.com> "Duncan Mak" writes: > Yeah, but the issue is that, as you know, to create a new file in > emacs, you give find-file a non-existent file and emacs will open up > a buffer for you and let you save it when you're done. OK, but in that case vc-git-registered needs to return failure, you cannot call git-ls-files as it may find the file in the wrong directory. I'd suggest something like this: >From abf4311add221102957145255d5418a7ec06fe1d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 22 Dec 2006 14:51:23 +0100 Subject: [PATCH] vc-git: Ignore errors caused by a non-existent directory in vc-git-registered. Signed-off-by: Alexandre Julliard --- contrib/emacs/vc-git.el | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/emacs/vc-git.el b/contrib/emacs/vc-git.el index 8b63619..3eb4bd1 100644 --- a/contrib/emacs/vc-git.el +++ b/contrib/emacs/vc-git.el @@ -58,8 +58,9 @@ (with-temp-buffer (let* ((dir (file-name-directory file)) (name (file-relative-name file dir))) - (when dir (cd dir)) - (and (ignore-errors (eq 0 (call-process "git" nil '(t nil) nil "ls-files" "-c" "-z" "--" name))) + (and (ignore-errors + (when dir (cd dir)) + (eq 0 (call-process "git" nil '(t nil) nil "ls-files" "-c" "-z" "--" name))) (let ((str (buffer-string))) (and (> (length str) (length name)) (string= (substring str 0 (1+ (length name))) (concat name "\0")))))))) -- 1.4.4.2.g28ce -- Alexandre Julliard julliard@winehq.org