{"thread":{"id":"11528","subject":"[PATCH 2/3] git.el: Refresh files from their real state upon commit.","startedAt":"2008-01-08T13:46:22Z","lastAt":"2008-01-08T13:46:22Z","messageCount":1,"participants":["Alexandre Julliard"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"64738","messageId":"87y7b0ig5t.fsf@wine.dyndns.org","threadId":"11528","inReplyTo":null,"subject":"[PATCH 2/3] git.el: Refresh files from their real state upon commit.","fromName":"Alexandre Julliard","fromEmail":"julliard@winehq.org","sentAt":"2008-01-08T13:46:22Z","receivedAt":"2008-01-08T13:46:22Z","isPatch":true,"sender":{"key":"julliard@winehq.org","avatar":null},"body":"Instead of just setting the state to up-to-date, retrieve the full\nstate again, so that the file type can be displayed properly.\n\nSigned-off-by: Alexandre Julliard <julliard@winehq.org>\n---\n contrib/emacs/git.el |   22 ++++++++++++----------\n 1 files changed, 12 insertions(+), 10 deletions(-)\n\ndiff --git a/contrib/emacs/git.el b/contrib/emacs/git.el\nindex 885ad20..825b1e9 100644\n--- a/contrib/emacs/git.el\n+++ b/contrib/emacs/git.el\n@@ -626,7 +626,8 @@ and returns the process output as a string.\"\n (defun git-run-diff-index (status files)\n   \"Run git-diff-index on FILES and parse the results into STATUS.\n Return the list of files that haven't been handled.\"\n-  (let (infolist)\n+  (let ((remaining (copy-sequence files))\n+        infolist)\n     (with-temp-buffer\n       (apply #'git-call-process-env t nil \"diff-index\" \"-z\" \"-M\" \"HEAD\" \"--\" files)\n       (goto-char (point-min))\n@@ -644,10 +645,10 @@ Return the list of files that haven't been handled.\"\n                 (push (git-create-fileinfo 'deleted name 0 0 'rename new-name) infolist)\n                 (push (git-create-fileinfo 'added new-name old-perm new-perm 'rename name) infolist))\n             (push (git-create-fileinfo (git-state-code state) name old-perm new-perm) infolist))\n-          (setq files (delete name files))\n-          (when new-name (setq files (delete new-name files))))))\n+          (setq remaining (delete name remaining))\n+          (when new-name (setq remaining (delete new-name remaining))))))\n     (git-insert-info-list status infolist)\n-    files))\n+    remaining))\n \n (defun git-find-status-file (status file)\n   \"Find a given file in the status ewoc and return its node.\"\n@@ -673,7 +674,8 @@ Return the list of files that haven't been handled.\"\n (defun git-run-ls-files-cached (status files default-state)\n   \"Run git-ls-files -c on FILES and parse the results into STATUS.\n Return the list of files that haven't been handled.\"\n-  (let (infolist)\n+  (let ((remaining (copy-sequence files))\n+        infolist)\n     (with-temp-buffer\n       (apply #'git-call-process-env t nil \"ls-files\" \"-z\" \"-s\" \"-c\" \"--\" files)\n       (goto-char (point-min))\n@@ -682,9 +684,9 @@ Return the list of files that haven't been handled.\"\n \t       (old-perm (if (eq default-state 'added) 0 new-perm))\n \t       (name (match-string 2)))\n \t  (push (git-create-fileinfo default-state name old-perm new-perm) infolist)\n-\t  (setq files (delete name files)))))\n+\t  (setq remaining (delete name remaining)))))\n     (git-insert-info-list status infolist)\n-    files))\n+    remaining))\n \n (defun git-run-ls-unmerged (status files)\n   \"Run git-ls-files -u on FILES and parse the results into STATUS.\"\n@@ -716,8 +718,8 @@ Return the list of files that haven't been handled.\"\n (defun git-update-status-files (files &optional default-state)\n   \"Update the status of FILES from the index.\"\n   (unless git-status (error \"Not in git-status buffer.\"))\n-  (unless files\n-    (when git-show-uptodate (git-run-ls-files-cached git-status nil 'uptodate)))\n+  (when (or git-show-uptodate files)\n+    (git-run-ls-files-cached git-status files 'uptodate))\n   (let* ((remaining-files\n           (if (git-empty-db-p) ; we need some special handling for an empty db\n \t      (git-run-ls-files-cached git-status files 'added)\n@@ -839,7 +841,7 @@ Return the list of files that haven't been handled.\"\n                             (condition-case nil (delete-file \".git/MERGE_HEAD\") (error nil))\n                             (condition-case nil (delete-file \".git/MERGE_MSG\") (error nil))\n                             (with-current-buffer buffer (erase-buffer))\n-                            (dolist (info files) (git-set-fileinfo-state info 'uptodate))\n+                            (git-update-status-files (git-get-filenames files) 'uptodate)\n                             (git-call-process-env nil nil \"rerere\")\n                             (git-call-process-env nil nil \"gc\" \"--auto\")\n                             (git-refresh-files)\n-- \n1.5.4.rc2.71.ge10a9\n\n-- \nAlexandre Julliard\njulliard@winehq.org\n"}]}