@matheusbsbs / matheus-bagliano / commits / 58152a02d9
Fork 0

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>

Alexandre Julliard committed Jan 8, 2008 at 14:46 UTC 58152a02d99b499c338b633e7fe021b337313bd8
1 file changed +12 -10
contrib/emacs/git.el
+12 -10
@@ -626,7 +626,8 @@ and returns the process output as a string."
626 (defun git-run-diff-index (status files)
627 "Run git-diff-index on FILES and parse the results into STATUS.
628 Return the list of files that haven't been handled."
629 - (let (infolist)
629 + (let ((remaining (copy-sequence files))
630 + infolist)
631 (with-temp-buffer
632 (apply #'git-call-process-env t nil "diff-index" "-z" "-M" "HEAD" "--" files)
633 (goto-char (point-min))
@@ -644,10 +645,10 @@ Return the list of files that haven't been handled."
645 (push (git-create-fileinfo 'deleted name 0 0 'rename new-name) infolist)
646 (push (git-create-fileinfo 'added new-name old-perm new-perm 'rename name) infolist))
647 (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))))))
650 (git-insert-info-list status infolist)
650 - files))
651 + remaining))
652
653 (defun git-find-status-file (status file)
654 "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."
674 (defun git-run-ls-files-cached (status files default-state)
675 "Run git-ls-files -c on FILES and parse the results into STATUS.
676 Return the list of files that haven't been handled."
676 - (let (infolist)
677 + (let ((remaining (copy-sequence files))
678 + infolist)
679 (with-temp-buffer
680 (apply #'git-call-process-env t nil "ls-files" "-z" "-s" "-c" "--" files)
681 (goto-char (point-min))
@@ -682,9 +684,9 @@ Return the list of files that haven't been handled."
684 (old-perm (if (eq default-state 'added) 0 new-perm))
685 (name (match-string 2)))
686 (push (git-create-fileinfo default-state name old-perm new-perm) infolist)
685 - (setq files (delete name files)))))
687 + (setq remaining (delete name remaining)))))
688 (git-insert-info-list status infolist)
687 - files))
689 + remaining))
690
691 (defun git-run-ls-unmerged (status files)
692 "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."
718 (defun git-update-status-files (files &optional default-state)
719 "Update the status of FILES from the index."
720 (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))
723 (let* ((remaining-files
724 (if (git-empty-db-p) ; we need some special handling for an empty db
725 (git-run-ls-files-cached git-status files 'added)
@@ -839,7 +841,7 @@ Return the list of files that haven't been handled."
841 (condition-case nil (delete-file ".git/MERGE_HEAD") (error nil))
842 (condition-case nil (delete-file ".git/MERGE_MSG") (error nil))
843 (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)
845 (git-call-process-env nil nil "rerere")
846 (git-call-process-env nil nil "gc" "--auto")
847 (git-refresh-files)