git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] fix vc git

From
AJAlexandre Julliard <julliard@winehq.org>
Date
Dec 22, 2006, 13:56 UTC
Message-ID
<87ac1guj9c.fsf@wine.dyndns.org>
In-Reply-To
<8e745ecf0612220451v367479dq13af2d829a9547c2@mail.gmail.com>
"Duncan Mak" <duncan@a-chinaman.com> 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 <julliard@winehq.org>
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 <julliard@winehq.org>
---
 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
Previous: Duncan MakNext: Duncan Mak
Message 9 of 10 in “fix vc git”
  1. fix vc gitDuncan Mak, Dec 21, 2006
  2. Jakub NarebskiDec 21, 2006
  3. Duncan MakDec 21, 2006
  4. Junio C HamanoDec 22, 2006
  5. Duncan MakDec 22, 2006
  6. Junio C HamanoDec 22, 2006
  7. Alexandre JulliardDec 22, 2006
  8. Duncan MakDec 22, 2006
  9. Alexandre JulliardDec 22, 2006
  10. Duncan MakDec 22, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.