unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric James Michael Ritz <Eric@cybersprocket.com>
To: emacs-devel@gnu.org
Subject: Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir
Date: Wed, 30 Jun 2010 10:17:51 -0400	[thread overview]
Message-ID: <i0fjmg$m3l$1@dough.gmane.org> (raw)


On 06/30/2010 08:58 AM, Deniz Dogan wrote:
> 2010/6/30 Deniz Dogan <deniz.a.m.dogan@gmail.com>:
>> 2010/6/30 Eric James Michael Ritz <Eric@cybersprocket.com>:
>>> +  (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'."





             reply	other threads:[~2010-06-30 14:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-30 14:17 Eric James Michael Ritz [this message]
2010-06-30 19:35 ` [PATCH] vc-git: Do not show `.git/*' files with vc-dir Dan Nicolaescu
2010-06-30 20:01   ` Eric James Michael Ritz
2010-06-30 22:21     ` Dan Nicolaescu
2010-07-01  0:07   ` Deniz Dogan
2010-07-01  1:20     ` Dan Nicolaescu
  -- strict thread matches above, loose matches on Subject: below --
2010-06-30 12:38 Eric James Michael Ritz
2010-06-30 12:57 ` Deniz Dogan
2010-06-30 12:58   ` Deniz Dogan
2010-06-30 13:08     ` Eric James Michael Ritz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='i0fjmg$m3l$1@dough.gmane.org' \
    --to=eric@cybersprocket.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).