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

Re: [PATCH] fix vc git

From
Duncan Mak <duncan@a-chinaman.com>
Date
Dec 22, 2006, 04:11 UTC
Message-ID
<8e745ecf0612212011q26f81d91uce143b4212fc5e8b@mail.gmail.com>
In-Reply-To
<7vhcvo92fx.fsf@assigned-by-dhcp.cox.net>

I don't think vc-git-registered-file will ever be called with a filename without a directory, as it is used as a hook on vc-next-action, which works on a real file.

Either way, it's a modified patch:
Fix vc-git.el to not cd into a non-existent directory.
---
 contrib/emacs/vc-git.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

base c902c9a608c1b727160d6fbb04fa363d9418cd00 last 96e9944b714094ab81f8091711a92506886b8004

diff --git a/contrib/emacs/vc-git.el b/contrib/emacs/vc-git.el
index 8b6361922fd6e6a2fcd9acb20fd54f5b645b36f0..668bd4a98653046aadf91e7a91af6cd76ba044d4
100644
--- a/contrib/emacs/vc-git.el
+++ b/contrib/emacs/vc-git.el
@@ -58,7 +58,7 @@
   (with-temp-buffer
     (let* ((dir (file-name-directory file))
            (name (file-relative-name file dir)))
-      (when dir (cd dir))
+      (when (and dir (file-exists-p dir)) (cd dir))
       (and (ignore-errors (eq 0 (call-process "git" nil '(t nil) nil
"ls-files" "-c" "-z" "--" name)))
            (let ((str (buffer-string)))
              (and (> (length str) (length name))
-- 
1.4.4.1
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 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.