Re: git emacs mode patch
- From
- Alexandre Julliard <julliard@winehq.org>
- Date
- Mar 26, 2007, 10:02 UTC
- Message-ID
- <878xdk491m.fsf@wine.dyndns.org>
- In-Reply-To
- <200703251903.15333.mega@retes.hu>
Gábor Melis <mega@retes.hu> writes:
Show 24 quoted lines
> @@ -515,15 +527,21 @@ and returns the process output as a string." > (setq node (ewoc-next status node))) > node)) > > -(defun git-parse-ls-files (status default-state &optional skip-existing) > +(defun git-parse-ls-files (status &optional default-state skip-existing) > "Parse the output of git-ls-files in the current buffer." > (goto-char (point-min)) > (let (infolist) > (while (re-search-forward "\\([HMRCK?]\\) \\([^\0]*\\)\0" nil t 1) > - (let ((state (match-string 1)) > - (name (match-string 2))) > - (unless (and skip-existing (git-find-status-file status name)) > - (push (git-create-fileinfo (or (git-state-code state) default-state) name) infolist)))) > + (let* ((state (or default-state > + (git-state-code (match-string 1)))) > + (name (match-string 2)) > + (node (git-find-status-file status name))) > + (if skip-existing > + (unless node > + (push (git-create-fileinfo state name) infolist)) > + (if node > + (git-set-files-state (list (ewoc-data node)) state) > + (push (git-create-fileinfo state name) infolist)))))
You don't want to do a git-find-status-file in all cases, this is O(n^2) and becomes much too slow on a large project. That's the reason there's a skip-existing flag, to avoid that cost in the common case.
-- Alexandre Julliard julliard@winehq.org