From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric James Michael Ritz Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir Date: Wed, 30 Jun 2010 10:17:51 -0400 Organization: Cyber Sprocket Labs Message-ID: Reply-To: Eric@cybersprocket.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1277907507 23297 80.91.229.12 (30 Jun 2010 14:18:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 30 Jun 2010 14:18:27 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 30 16:18:26 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OTy7M-0002ZN-GX for ged-emacs-devel@m.gmane.org; Wed, 30 Jun 2010 16:18:24 +0200 Original-Received: from localhost ([127.0.0.1]:33022 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTy7L-0000xi-MH for ged-emacs-devel@m.gmane.org; Wed, 30 Jun 2010 10:18:23 -0400 Original-Received: from [140.186.70.92] (port=43223 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTy7B-0000xd-3H for emacs-devel@gnu.org; Wed, 30 Jun 2010 10:18:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OTy75-00063d-Ro for emacs-devel@gnu.org; Wed, 30 Jun 2010 10:18:13 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:34303) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OTy75-00062o-F2 for emacs-devel@gnu.org; Wed, 30 Jun 2010 10:18:07 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OTy72-0002LY-Dp for emacs-devel@gnu.org; Wed, 30 Jun 2010 16:18:04 +0200 Original-Received: from adsl-072-156-193-234.sip.chs.bellsouth.net ([72.156.193.234]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 30 Jun 2010 16:18:04 +0200 Original-Received: from Eric by adsl-072-156-193-234.sip.chs.bellsouth.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 30 Jun 2010 16:18:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 51 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: adsl-072-156-193-234.sip.chs.bellsouth.net User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 X-Enigmail-Version: 1.0.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:126534 Archived-At: On 06/30/2010 08:58 AM, Deniz Dogan wrote: > 2010/6/30 Deniz Dogan : >> 2010/6/30 Eric James Michael Ritz : >>> + (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'."