Re: git emacs mode patch

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

 



Gábor Melis <mega@xxxxxxxx> writes:

> @@ -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@xxxxxxxxxx
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]