{"thread":{"id":"11529","subject":"[PATCH 3/3] git.el: Make status refresh faster.","startedAt":"2008-01-08T13:49:09Z","lastAt":"2008-01-08T13:49:09Z","messageCount":1,"participants":["Alexandre Julliard"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"64739","messageId":"87r6gsig16.fsf@wine.dyndns.org","threadId":"11529","inReplyTo":null,"subject":"[PATCH 3/3] git.el: Make status refresh faster.","fromName":"Alexandre Julliard","fromEmail":"julliard@winehq.org","sentAt":"2008-01-08T13:49:09Z","receivedAt":"2008-01-08T13:49:09Z","isPatch":true,"sender":{"key":"julliard@winehq.org","avatar":null},"body":"Don't set the needs-refresh flag when inserting a new file info, since\newoc refreshes it upon insert already; this makes a full refresh twice\nas fast.\n\nAlso make git-fileinfo-prettyprint a little faster by not retrieving\npermission values twice.\n\nSigned-off-by: Alexandre Julliard <julliard@winehq.org>\n---\n contrib/emacs/git.el |   24 +++++++++++++-----------\n 1 files changed, 13 insertions(+), 11 deletions(-)\n\ndiff --git a/contrib/emacs/git.el b/contrib/emacs/git.el\nindex 825b1e9..8f39ebe 100644\n--- a/contrib/emacs/git.el\n+++ b/contrib/emacs/git.el\n@@ -538,10 +538,10 @@ and returns the process output as a string.\"\n     ('ignored  (propertize \"Ignored \" 'face 'git-ignored-face))\n     (t \"?       \")))\n \n-(defun git-file-type-as-string (info)\n-  \"Return a string describing the file type of INFO.\"\n-  (let* ((old-type (lsh (or (git-fileinfo->old-perm info) 0) -9))\n-\t (new-type (lsh (or (git-fileinfo->new-perm info) 0) -9))\n+(defun git-file-type-as-string (old-perm new-perm)\n+  \"Return a string describing the file type based on its permissions.\"\n+  (let* ((old-type (lsh (or old-perm 0) -9))\n+         (new-type (lsh (or new-perm 0) -9))\n \t (str (case new-type\n \t\t(?\\100  ;; file\n \t\t (case old-type\n@@ -590,12 +590,14 @@ and returns the process output as a string.\"\n \n (defun git-fileinfo-prettyprint (info)\n   \"Pretty-printer for the git-fileinfo structure.\"\n-  (insert (concat \"   \" (if (git-fileinfo->marked info) (propertize \"*\" 'face 'git-mark-face) \" \")\n-                  \" \" (git-status-code-as-string (git-fileinfo->state info))\n-                  \" \" (git-permissions-as-string (git-fileinfo->old-perm info) (git-fileinfo->new-perm info))\n-                  \"  \" (git-escape-file-name (git-fileinfo->name info))\n-\t\t  (git-file-type-as-string info)\n-                  (git-rename-as-string info))))\n+  (let ((old-perm (git-fileinfo->old-perm info))\n+        (new-perm (git-fileinfo->new-perm info)))\n+    (insert (concat \"   \" (if (git-fileinfo->marked info) (propertize \"*\" 'face 'git-mark-face) \" \")\n+                    \" \" (git-status-code-as-string (git-fileinfo->state info))\n+                    \" \" (git-permissions-as-string old-perm new-perm)\n+                    \"  \" (git-escape-file-name (git-fileinfo->name info))\n+                    (git-file-type-as-string old-perm new-perm)\n+                    (git-rename-as-string info)))))\n \n (defun git-insert-info-list (status infolist)\n   \"Insert a list of file infos in the status buffer, replacing existing ones if any.\"\n@@ -606,7 +608,6 @@ and returns the process output as a string.\"\n   (let ((info (pop infolist))\n         (node (ewoc-nth status 0)))\n     (while info\n-      (setf (git-fileinfo->needs-refresh info) t)\n       (cond ((not node)\n              (setq node (ewoc-enter-last status info))\n              (setq info (pop infolist)))\n@@ -617,6 +618,7 @@ and returns the process output as a string.\"\n                            (git-fileinfo->name info))\n               ;; preserve the marked flag\n               (setf (git-fileinfo->marked info) (git-fileinfo->marked (ewoc-data node)))\n+              (setf (git-fileinfo->needs-refresh info) t)\n               (setf (ewoc-data node) info)\n               (setq info (pop infolist)))\n             (t\n-- \n1.5.4.rc2.71.ge10a9\n\n-- \nAlexandre Julliard\njulliard@winehq.org\n"}]}