emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir


From: Dan Nicolaescu
Subject: Re: [PATCH] vc-git: Do not show `.git/*' files with vc-dir
Date: Wed, 30 Jun 2010 18:21:34 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Eric James Michael Ritz <address@hidden> writes:

> On 06/30/2010 03:35 PM, Dan Nicolaescu wrote:
>> Eric James Michael Ritz <address@hidden> writes:
>>
>>>[...]
>>>
>>> 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)
>>
>> file is an absolute file name, so this condition cannot be true.
>>
>> I still need to think what the best way of solving this is...
>
> Ah, I didn’t know that about `file`.  Thanks.
>
> While I am interested in solving this for Git specifically, since that
> is all I use at work, is it possible that a more general solution
> would be appropriate?  I am not very familiar with Bazaar or Mercurial
> or such, but I assume they use directories like ‘.git’ and ‘.svn’ for
> storing repository information.  If it is possible to also make those
> files appear in vc-dir by using terminal commands where $EDITOR is set
> to emacsclient, then could it be more beneficial to teach vc-dir as a
> whole to ignore files from the important, ‘system-level’ directories
> for the various version control back-ends?

There was a bug in vc-dir that I fixed in the emacs-23 branch, it
displayed files with a nil state.  To reproduce: just edit .hg/BLAH
and see it appear in the corresponding vc-dir buffer.

The above fix should fix similar problems for hg, svn and CVS (maybe
more, but I haven't tried).

vc-git has some more problems: vc-git-state returns 'unregistered even
for non-existent files.  It should return nil.  It also returns
'unregistered for files in .git, it should return nil there too.



reply via email to

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