Skip to content

Commit c4e8b72

Browse files
committed
git.el: Add possibility to mark files directly in git-update-status-files.
This avoids the need to go through the list twice, which helps performance on large file lists. Signed-off-by: Alexandre Julliard <julliard@winehq.org>
1 parent b0a53e9 commit c4e8b72

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

contrib/emacs/git.el

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ Return the list of files that haven't been handled."
752752
(concat "--exclude-per-directory=" git-per-dir-ignore-file)
753753
(append options (mapcar (lambda (f) (concat "--exclude-from=" f)) exclude-files)))))
754754

755-
(defun git-update-status-files (&optional files)
755+
(defun git-update-status-files (&optional files mark-files)
756756
"Update the status of FILES from the index."
757757
(unless git-status (error "Not in git-status buffer."))
758758
;; set the needs-update flag on existing files
@@ -777,12 +777,12 @@ Return the list of files that haven't been handled."
777777
(when remaining-files
778778
(setq remaining-files (git-run-ls-files-cached git-status remaining-files 'uptodate)))
779779
(git-set-filenames-state git-status remaining-files nil)
780+
(when mark-files (git-mark-files git-status files))
780781
(git-refresh-files)
781782
(git-refresh-ewoc-hf git-status)))
782783

783784
(defun git-mark-files (status files)
784785
"Mark all the specified FILES, and unmark the others."
785-
(setq files (sort files #'string-lessp))
786786
(let ((file (and files (pop files)))
787787
(node (ewoc-nth status 0)))
788788
(while node
@@ -1371,9 +1371,7 @@ amended version of it."
13711371
(git-call-process-display-error "reset" "--soft" "HEAD^")
13721372
(and (git-update-ref "ORIG_HEAD" commit)
13731373
(git-update-ref "HEAD" nil commit)))
1374-
(git-update-status-files (copy-sequence files))
1375-
(git-mark-files git-status files)
1376-
(git-refresh-files)
1374+
(git-update-status-files files t)
13771375
(git-setup-commit-buffer commit)
13781376
(git-commit-file))))
13791377

0 commit comments

Comments
 (0)