emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vc-git] Showing ‘.git/*’ files in vc-dir


From: Dan Nicolaescu
Subject: Re: [vc-git] Showing ‘.git/*’ files in vc-dir
Date: Thu, 01 Jul 2010 02:44:12 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Miles Bader <address@hidden> writes:

> Dan Nicolaescu <address@hidden> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]