@matheusbsbs / matheus-bagliano / commits / c4e8b72f22
Fork 0

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>

Alexandre Julliard committed Nov 1, 2008 at 20:14 UTC c4e8b72f228b20d3ed6cfba0586364ea8ca431af
1 file changed +3 -5
contrib/emacs/git.el
+3 -5
@@ -752,7 +752,7 @@ Return the list of files that haven't been handled."
752 (concat "--exclude-per-directory=" git-per-dir-ignore-file)
753 (append options (mapcar (lambda (f) (concat "--exclude-from=" f)) exclude-files)))))
754
755 -(defun git-update-status-files (&optional files)
755 +(defun git-update-status-files (&optional files mark-files)
756 "Update the status of FILES from the index."
757 (unless git-status (error "Not in git-status buffer."))
758 ;; set the needs-update flag on existing files
@@ -777,12 +777,12 @@ Return the list of files that haven't been handled."
777 (when remaining-files
778 (setq remaining-files (git-run-ls-files-cached git-status remaining-files 'uptodate)))
779 (git-set-filenames-state git-status remaining-files nil)
780 + (when mark-files (git-mark-files git-status files))
781 (git-refresh-files)
782 (git-refresh-ewoc-hf git-status)))
783
784 (defun git-mark-files (status files)
785 "Mark all the specified FILES, and unmark the others."
785 - (setq files (sort files #'string-lessp))
786 (let ((file (and files (pop files)))
787 (node (ewoc-nth status 0)))
788 (while node
@@ -1371,9 +1371,7 @@ amended version of it."
1371 (git-call-process-display-error "reset" "--soft" "HEAD^")
1372 (and (git-update-ref "ORIG_HEAD" commit)
1373 (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)
1375 (git-setup-commit-buffer commit)
1376 (git-commit-file))))
1377