[Top][All Lists]

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

Re: A project-files implementation for Git projects

From: Tassilo Horn
Subject: Re: A project-files implementation for Git projects
Date: Tue, 10 Sep 2019 08:25:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> (cl-defmethod project-files ((project (head vc)) &optional dirs)
>>   "Implementation of `project-files' for Git projects."
>>   (cl-mapcan
>>    (lambda (dir)
>>      (if-let ((git (and (file-exists-p
>>                          (expand-file-name ".git/config" dir))
>>                         (executable-find "git"))))
> Since it's a handler for `vc` it should handle all VC backends.  To do
> that, it can simply use the `vc-call-backend` mechanism, so the
> Git-specific code can be put inside vc-git and you can have a generic
> implementation that does just the `cl-call-next-method`.

I didn't know that mechanism, so I have some more questions.

Would that mean that I would need to add functions

  vc-git-list-files (using: git ls-files)
  vc-hg-list-files (using: hg files)

for all backends which support listing tracked files?

And then project-files would call (vc-call-backend backend 'list-files)
and if that signals vc-not-supported call cl-call-next-method?  But how
do I know the right backend without explicit tests?  vc-backend wants a
file and all I have is the project's directory.

Also, I think most vc backends have a way to list tracked files but not
all those are faster than find is.  "git ls-files" is much faster than
find but short testing revealed that "hg files" is much slower.  I don't
think it would be a good idea to use it in project-files where speed is
important.  So name the vc function vc-<backend>-list-files-fast and
only provide an implementation for Git?


reply via email to

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