git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git emacs mode patch

From
AJAlexandre 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
Previous: Gábor Melis
Message 4 of 4 in “git emacs mode patch”
  1. Gábor MelisMar 15, 2007
  2. Alexandre JulliardMar 17, 2007
  3. Gábor MelisMar 25, 2007
  4. Alexandre JulliardMar 26, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.