summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 58152a0)
raw | patch | inline | side by side (parent: 58152a0)
author | Alexandre Julliard <julliard@winehq.org> | |
Tue, 8 Jan 2008 13:49:09 +0000 (14:49 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 9 Jan 2008 00:17:44 +0000 (16:17 -0800) |
Don't set the needs-refresh flag when inserting a new file info, since
ewoc refreshes it upon insert already; this makes a full refresh twice
as fast.
Also make git-fileinfo-prettyprint a little faster by not retrieving
permission values twice.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ewoc refreshes it upon insert already; this makes a full refresh twice
as fast.
Also make git-fileinfo-prettyprint a little faster by not retrieving
permission values twice.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/emacs/git.el | patch | blob | history |
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 342c78348ed66566be2afa61e748eef7d971aaa2..d8a06381f4140a777f03fda67f68838e4aa3e493 100644 (file)
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
('ignored (propertize "Ignored " 'face 'git-ignored-face))
(t "? ")))
-(defun git-file-type-as-string (info)
- "Return a string describing the file type of INFO."
- (let* ((old-type (lsh (or (git-fileinfo->old-perm info) 0) -9))
- (new-type (lsh (or (git-fileinfo->new-perm info) 0) -9))
+(defun git-file-type-as-string (old-perm new-perm)
+ "Return a string describing the file type based on its permissions."
+ (let* ((old-type (lsh (or old-perm 0) -9))
+ (new-type (lsh (or new-perm 0) -9))
(str (case new-type
(?\100 ;; file
(case old-type
(defun git-fileinfo-prettyprint (info)
"Pretty-printer for the git-fileinfo structure."
- (insert (concat " " (if (git-fileinfo->marked info) (propertize "*" 'face 'git-mark-face) " ")
- " " (git-status-code-as-string (git-fileinfo->state info))
- " " (git-permissions-as-string (git-fileinfo->old-perm info) (git-fileinfo->new-perm info))
- " " (git-escape-file-name (git-fileinfo->name info))
- (git-file-type-as-string info)
- (git-rename-as-string info))))
+ (let ((old-perm (git-fileinfo->old-perm info))
+ (new-perm (git-fileinfo->new-perm info)))
+ (insert (concat " " (if (git-fileinfo->marked info) (propertize "*" 'face 'git-mark-face) " ")
+ " " (git-status-code-as-string (git-fileinfo->state info))
+ " " (git-permissions-as-string old-perm new-perm)
+ " " (git-escape-file-name (git-fileinfo->name info))
+ (git-file-type-as-string old-perm new-perm)
+ (git-rename-as-string info)))))
(defun git-insert-info-list (status infolist)
"Insert a list of file infos in the status buffer, replacing existing ones if any."
(let ((info (pop infolist))
(node (ewoc-nth status 0)))
(while info
- (setf (git-fileinfo->needs-refresh info) t)
(cond ((not node)
(setq node (ewoc-enter-last status info))
(setq info (pop infolist)))
(git-fileinfo->name info))
;; preserve the marked flag
(setf (git-fileinfo->marked info) (git-fileinfo->marked (ewoc-data node)))
+ (setf (git-fileinfo->needs-refresh info) t)
(setf (ewoc-data node) info)
(setq info (pop infolist)))
(t