Skip to content

Commit 58152a0

Browse files
julliardgitster
authored andcommitted
git.el: Refresh files from their real state upon commit.
Instead of just setting the state to up-to-date, retrieve the full state again, so that the file type can be displayed properly. Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 87e3d81 commit 58152a0

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

contrib/emacs/git.el

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,8 @@ and returns the process output as a string."
626626
(defun git-run-diff-index (status files)
627627
"Run git-diff-index on FILES and parse the results into STATUS.
628628
Return the list of files that haven't been handled."
629-
(let (infolist)
629+
(let ((remaining (copy-sequence files))
630+
infolist)
630631
(with-temp-buffer
631632
(apply #'git-call-process-env t nil "diff-index" "-z" "-M" "HEAD" "--" files)
632633
(goto-char (point-min))
@@ -644,10 +645,10 @@ Return the list of files that haven't been handled."
644645
(push (git-create-fileinfo 'deleted name 0 0 'rename new-name) infolist)
645646
(push (git-create-fileinfo 'added new-name old-perm new-perm 'rename name) infolist))
646647
(push (git-create-fileinfo (git-state-code state) name old-perm new-perm) infolist))
647-
(setq files (delete name files))
648-
(when new-name (setq files (delete new-name files))))))
648+
(setq remaining (delete name remaining))
649+
(when new-name (setq remaining (delete new-name remaining))))))
649650
(git-insert-info-list status infolist)
650-
files))
651+
remaining))
651652

652653
(defun git-find-status-file (status file)
653654
"Find a given file in the status ewoc and return its node."
@@ -673,7 +674,8 @@ Return the list of files that haven't been handled."
673674
(defun git-run-ls-files-cached (status files default-state)
674675
"Run git-ls-files -c on FILES and parse the results into STATUS.
675676
Return the list of files that haven't been handled."
676-
(let (infolist)
677+
(let ((remaining (copy-sequence files))
678+
infolist)
677679
(with-temp-buffer
678680
(apply #'git-call-process-env t nil "ls-files" "-z" "-s" "-c" "--" files)
679681
(goto-char (point-min))
@@ -682,9 +684,9 @@ Return the list of files that haven't been handled."
682684
(old-perm (if (eq default-state 'added) 0 new-perm))
683685
(name (match-string 2)))
684686
(push (git-create-fileinfo default-state name old-perm new-perm) infolist)
685-
(setq files (delete name files)))))
687+
(setq remaining (delete name remaining)))))
686688
(git-insert-info-list status infolist)
687-
files))
689+
remaining))
688690

689691
(defun git-run-ls-unmerged (status files)
690692
"Run git-ls-files -u on FILES and parse the results into STATUS."
@@ -716,8 +718,8 @@ Return the list of files that haven't been handled."
716718
(defun git-update-status-files (files &optional default-state)
717719
"Update the status of FILES from the index."
718720
(unless git-status (error "Not in git-status buffer."))
719-
(unless files
720-
(when git-show-uptodate (git-run-ls-files-cached git-status nil 'uptodate)))
721+
(when (or git-show-uptodate files)
722+
(git-run-ls-files-cached git-status files 'uptodate))
721723
(let* ((remaining-files
722724
(if (git-empty-db-p) ; we need some special handling for an empty db
723725
(git-run-ls-files-cached git-status files 'added)
@@ -839,7 +841,7 @@ Return the list of files that haven't been handled."
839841
(condition-case nil (delete-file ".git/MERGE_HEAD") (error nil))
840842
(condition-case nil (delete-file ".git/MERGE_MSG") (error nil))
841843
(with-current-buffer buffer (erase-buffer))
842-
(dolist (info files) (git-set-fileinfo-state info 'uptodate))
844+
(git-update-status-files (git-get-filenames files) 'uptodate)
843845
(git-call-process-env nil nil "rerere")
844846
(git-call-process-env nil nil "gc" "--auto")
845847
(git-refresh-files)

0 commit comments

Comments
 (0)