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: [vc-git] Showing =?utf-8?b?4oCYLmdpdC8q4oCZIGZpbGVzIGluIHZj?= =?utf-8?q?-dir?= Date: Sun, 04 Jul 2010 15:45:06 -0400 Organization: Cyber Sprocket Labs Message-ID: <4C30E4C2.9020500@cybersprocket.com> References: <4C2A5279.2080706@cybersprocket.com> <4C30C459.6050904@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 1278272724 22237 80.91.229.12 (4 Jul 2010 19:45:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 4 Jul 2010 19:45:24 +0000 (UTC) Cc: emacs-devel@gnu.org, Stefan Monnier , Miles Bader To: Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 04 21:45:22 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 1OVV7w-0008Ps-RM for ged-emacs-devel@m.gmane.org; Sun, 04 Jul 2010 21:45:22 +0200 Original-Received: from localhost ([127.0.0.1]:46901 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVV7w-0001Pm-7l for ged-emacs-devel@m.gmane.org; Sun, 04 Jul 2010 15:45:20 -0400 Original-Received: from [140.186.70.92] (port=34128 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVV7q-0001PF-Tc for emacs-devel@gnu.org; Sun, 04 Jul 2010 15:45:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OVV7p-0001GA-Ka for emacs-devel@gnu.org; Sun, 04 Jul 2010 15:45:14 -0400 Original-Received: from host.cybersprocket.com ([72.52.158.193]:60297) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVV7l-0001FG-RJ; Sun, 04 Jul 2010 15:45:09 -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=IjUKKGRcGNotqhk1jzlfaqpi3FkwvvPeS64XCRVMPXwL2qy9hX7Ie6etemGRSKoUrv/Q6b/UDHCYHHI/0IrLCd500sQDY8qay/MciLRV8LdD7eJ7Mn3ANYYwmnpmI2kh; Original-Received: from adsl-070-154-071-008.sip.chs.bellsouth.net ([70.154.71.8] helo=[10.1.10.120]) by host.cybersprocket.com with esmtp (Exim 4.69) (envelope-from ) id 1OVV7Y-0001p9-JH; Sun, 04 Jul 2010 15:44:56 -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-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:126761 Archived-At: On 07/04/2010 03:30 PM, Dan Nicolaescu wrote: > Eric James Michael Ritz writes: > > [...] >> >> * generic-x.el (bat-generic-mode): Fix regexp for command line >> diff --git a/lisp/vc-git.el b/lisp/vc-git.el >> index 24062a0..ee94ee4 100644 >> --- a/lisp/vc-git.el >> +++ b/lisp/vc-git.el >> @@ -171,16 +171,32 @@ 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))))) >> + ;; A file in a '.git/' directory. >> + (cond ((string-match-p (rx string-start >> + (zero-or-more anything) >> + (optional "/") >> + ".git/" >> + (optional (zero-or-more anything))) >> + file) >> + nil) > > Nothing else in vc-git.el uses `rx', for consistency it would be > better to avoid it here too. Noted. > Does this work on MS windows too? > I'd like a second opinion about this: should we go for file name > matching as above, or just use "git ls-files"? I have not tried it on Windows, but I will look into it. Using `git ls-files` could also be possible. Running something like $ git ls-files .git/COMMIT_EDITMSG -t --others gives us ? .git/COMMIT_EDITMSG `vc-git--state-code` doesn’t know about ‘?’, which just means ‘other’ in Git. Maybe we should return nil for files with that state code? That’s one possibility. But I agree, second opinion from a Git user would be useful. >> + ;; Unregistered or ignored file. >> + ((not (vc-git-registered file)) >> + (if (vc-git-file-is-ignored (file-relative-name file)) >> + 'ignored >> + '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-file-is-ignored (file) >> + "Returns non-nil if the `file' is not being ignored." >> + (vc-git--run-command-string >> + file "ls-files" "--others" "--ignored" "--exclude-standard" "--")) >> >> (defun vc-git-working-revision (file) >> "Git-specific version of `vc-working-revision'." >> -- >> 1.7.2.rc1 > -- Eric James Michael Ritz Cyber Sprocket Labs (843) 225-3830