emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir


From: Eric James Michael Ritz
Subject: Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir
Date: Wed, 30 Jun 2010 09:08:51 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 06/30/2010 08:58 AM, Deniz Dogan wrote:
> 2010/6/30 Deniz Dogan <address@hidden>:
>> 2010/6/30 Eric James Michael Ritz <address@hidden>:
>>> +  (cond ((string-match ".git" file)
>>
>> Wouldn't "\\`\\.git\\'" be more appropriate? ".git" would match
>> anything which contains "git" preceded by at least one character.
>>
>
> Or actually, (string= ".git" file), I suppose. :)

Whoops, you’re right.  Thanks for the catch :)  Fixed patch below:

diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 24062a0..62e0c55 100644
- --- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -171,16 +171,21 @@ If nil, use the value of `vc-diff-switches'.  If t, use 
no switches."

 (defun vc-git-state (file)
   "Git-specific version of `vc-state'."
- -  ;; FIXME: This can't set 'ignored yet
- -  (if (not (vc-git-registered file))
- -      'unregistered
- -    (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
- -    (let ((diff (vc-git--run-command-string
- -                 file "diff-index" "-z" "HEAD" "--")))
- -      (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} 
[0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
- -                               diff))
- -       (vc-git--state-code (match-string 1 diff))
- -     (if (vc-git--empty-db-p) 'added 'up-to-date)))))
+  ;; We never want to perform VC operations on files in the `.git'
+  ;; directory.
+  (cond ((string= ".git" file)
+         nil)
+        ;; FIXME: This can't set 'ignored yet.
+        ((not (vc-git-registered file))
+         'unregistered)
+        (t
+         (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
+         (let ((diff (vc-git--run-command-string
+                      file "diff-index" "-z" "HEAD" "--")))
+           (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} 
[0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0"
+                                       diff))
+               (vc-git--state-code (match-string 1 diff))
+             (if (vc-git--empty-db-p) 'added 'up-to-date))))))

 (defun vc-git-working-revision (file)
   "Git-specific version of `vc-working-revision'."

- --
Eric James Michael Ritz
Cyber Sprocket Labs
(843) 225-3830
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMK0HfAAoJEEHUZXw5hMWsj+8IANlGzBOblHmjpuUXUno40QE1
PMyeE2YSIAzYWZ4amnuqVQE0AJg4zGVF7hG3b1e5Q0ve7HypGPWku44POU7E55oF
VmQOgHb0asa3irOxmXToBE5T8em0CuzYn6b7U8dXxx8YrXAz1IG2tUYyHmyLo60N
yr5pnIj69M02dbnsxlOpicyEYomR7R1R5afTFFFMCgEv1IICeLQHxSDkx54ZI5Cr
Xgyb2vLTEubJwAdvz4BTShZd1VJlKCivHLcpKfwweC+kcCq+u0oPD3Fws8tjevry
/BhARchmr9zCygmJ6sIe0QS7YvqEsXeZaFt2AjYobV/nvTN5gkXqsCzEBLUwPxQ=
=rzqG
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]