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: Thu, 01 Jul 2010 09:40:01 -0400 Organization: Cyber Sprocket Labs Message-ID: <4C2C9AB1.3080800@cybersprocket.com> References: <4C2A5279.2080706@cybersprocket.com> 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: 7bit X-Trace: dough.gmane.org 1277991642 6614 80.91.229.12 (1 Jul 2010 13:40:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 1 Jul 2010 13:40:42 +0000 (UTC) Cc: Stefan Monnier , Miles Bader To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 01 15:40:39 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 1OUK0K-0002SE-IQ for ged-emacs-devel@m.gmane.org; Thu, 01 Jul 2010 15:40:37 +0200 Original-Received: from localhost ([127.0.0.1]:58246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUK0I-0006ZL-Pc for ged-emacs-devel@m.gmane.org; Thu, 01 Jul 2010 09:40:34 -0400 Original-Received: from [140.186.70.92] (port=51981 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUK0A-0006Xd-03 for emacs-devel@gnu.org; Thu, 01 Jul 2010 09:40:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OUK07-0000K6-TF for emacs-devel@gnu.org; Thu, 01 Jul 2010 09:40:25 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:50975) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OUK07-0000Jt-Fa for emacs-devel@gnu.org; Thu, 01 Jul 2010 09:40:23 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OUK03-0002Gi-5S for emacs-devel@gnu.org; Thu, 01 Jul 2010 15:40:19 +0200 Original-Received: from 173.221.45.130.nw.nuvox.net ([173.221.45.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 01 Jul 2010 15:40:19 +0200 Original-Received: from Eric by 173.221.45.130.nw.nuvox.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 01 Jul 2010 15:40:19 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 76 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 173.221.45.130.nw.nuvox.net 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-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:126619 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 07/01/2010 02:44 AM, Dan Nicolaescu wrote: > Miles Bader writes: > >> Dan Nicolaescu writes: >>>>> Not sure what the best solution is: make vc-git-state return >>>>> nil, or make vc-dir ignore files in .git, or something else ... >>>> >>>> Maybe find-file shouldn't add unregistered files to vc-dir buffers. >>> >>> Sure it should, one wants to be able to register those files. >> >> One can visit the file and "register" it that way, right (C-x v v)? > > This is going on the wrong track. > > The problem is not unrelated to adding 'unregistered files. > > The issue is that vc-git-state says 'unregistered for files that it > should not say 'unregistered. > > (vc-git-state "SOME_FILE_THAT_DOES_NOT_EXIST") says 'unregistered > > (vc-git-state ".git/HEAD") says 'unregistered > > > This patch seems to fix it: > > === modified file 'lisp/vc/vc-git.el' > --- lisp/vc/vc-git.el 2010-06-11 19:09:57 +0000 > +++ lisp/vc/vc-git.el 2010-07-01 06:37:30 +0000 > @@ -180,7 +180,9 @@ If nil, use the value of `vc-diff-switch > ;; was modified upstream. But we can't check that without a network > ;; operation. > (if (not (vc-git-registered file)) > - 'unregistered > + (let ((st (vc-git--run-command-string > + file "ls-files" "-t" "-o" "--"))) > + (if (and (stringp st) (not (string= st ""))) 'unregistered nil)) > (vc-git--call nil "add" "--refresh" "--" (file-relative-name file)) > (let ((diff (vc-git--run-command-string > file "diff-index" "-z" "HEAD" "--"))) > > > It would be nice if someone more familiar with the git low level > commands would take a look at this function and try to make it a bit better. > As the comment there says, it should be able to return 'ignored. > It would be nice if it could be able to return 'conflict too. In the `-t` needed in the call to git-ls-files? It we are just interested in whether or not the file is there, the `-o` by itself will work fine. We should also be able to use `git ls-files --ignored - --exclude-standard -- $file` to see if we need to return 'ignored for a file. - -- 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/ iQEcBAEBAgAGBQJMLJquAAoJEEHUZXw5hMWsBzcH/R5m5qNqcWTJQubmt/x4OC3N 2EBtIkaDSPEPehDD4tLfA/Ppbd0gNyGDQqyk4TSUOGIQR67HIrQf7MVl4x9Sf5md 4YFjt9xM9xPSW48NWNn2A9xlcejCFwAL7fcq5T3sA2oLmofeYMu36mriAniGHTbq DQ0xxsdr0FHjKltgah2bwvMUqIXUQfBnYBg9WlzYOsWnzUzTWFi4LaYgtWKzyaRz YifXT8RS4SiRuEWXM16KF/qDuQQ/l3+uL1safnRjKr378Pp3k+t8k0CeX5+EGfvX cmbNIuJ5Vyo0+r8UJM0SFg+qmBZf7YSzwiQuNi/D3n1G05dIvM/RvrJFm7MRFr4= =/09u -----END PGP SIGNATURE-----