All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Julliard <julliard@winehq.org>
To: "Gábor Melis" <mega@retes.hu>
Cc: git@vger.kernel.org
Subject: Re: git emacs mode patch
Date: Mon, 26 Mar 2007 12:02:29 +0200	[thread overview]
Message-ID: <878xdk491m.fsf@wine.dyndns.org> (raw)
In-Reply-To: <200703251903.15333.mega@retes.hu> (Gábor Melis's message of "Sun\, 25 Mar 2007 19\:03\:15 +0200")

Gábor Melis <mega@retes.hu> 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@winehq.org

      reply	other threads:[~2007-03-26 10:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-15 13:03 git emacs mode patch Gábor Melis
2007-03-17 10:04 ` Alexandre Julliard
2007-03-25 17:03   ` Gábor Melis
2007-03-26 10:02     ` Alexandre Julliard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878xdk491m.fsf@wine.dyndns.org \
    --to=julliard@winehq.org \
    --cc=git@vger.kernel.org \
    --cc=mega@retes.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.