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 09:08:51 -0400 Organization: Cyber Sprocket Labs Message-ID: <4C2B41E3.9010305@cybersprocket.com> References: 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 1277917970 976 80.91.229.12 (30 Jun 2010 17:12:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 30 Jun 2010 17:12:50 +0000 (UTC) Cc: emacs-devel@gnu.org To: Deniz Dogan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 30 19:12:47 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 1OU0q6-00028G-P0 for ged-emacs-devel@m.gmane.org; Wed, 30 Jun 2010 19:12:47 +0200 Original-Received: from localhost ([127.0.0.1]:48467 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OU0q5-0003XZ-Td for ged-emacs-devel@m.gmane.org; Wed, 30 Jun 2010 13:12:46 -0400 Original-Received: from [140.186.70.92] (port=59522 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTx27-00022h-05 for emacs-devel@gnu.org; Wed, 30 Jun 2010 09:08:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OTx25-0000Sn-Cc for emacs-devel@gnu.org; Wed, 30 Jun 2010 09:08:54 -0400 Original-Received: from host.cybersprocket.com ([72.52.158.193]:52774) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OTx25-0000Sd-2Y for emacs-devel@gnu.org; Wed, 30 Jun 2010 09:08:53 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=cybersprocket.com; h=Received:Message-ID:Date:From:Organization:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:X-Enigmail-Version:Content-Type:Content-Transfer-Encoding; b=hZSbf5e2RodXuFv5gQK9Q1cIWqLRb1BH8UgVQjW++Jq6JvX7w+mcwiRBw2SvmXZ0FrHQJb8XPS6yC+ISqtZ5sHJrp39FErqSp/YmkCpzm1S8VVXbwgsYIrNANLPw873l; Original-Received: from 173.221.45.130.nw.nuvox.net ([173.221.45.130] helo=[10.1.10.120]) by host.cybersprocket.com with esmtp (Exim 4.69) (envelope-from ) id 1OTx1x-0000Kx-BE; Wed, 30 Jun 2010 09:08:45 -0400 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 In-Reply-To: X-Enigmail-Version: 1.0.1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.cybersprocket.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - cybersprocket.com X-detected-operating-system: by eggs.gnu.org: Linux 2.6? (barebone, rare!) X-Mailman-Approved-At: Wed, 30 Jun 2010 13:12:34 -0400 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:126536 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 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'." - -- 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-----