{"thread":{"id":"11494","subject":"[PATCH 2/3] git.el: Retrieve the permissions for up-to-date files.","startedAt":"2008-01-06T11:13:01Z","lastAt":"2008-01-06T11:13:01Z","messageCount":1,"participants":["Alexandre Julliard"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"64587","messageId":"873atb8awy.fsf@wine.dyndns.org","threadId":"11494","inReplyTo":null,"subject":"[PATCH 2/3] git.el: Retrieve the permissions for up-to-date files.","fromName":"Alexandre Julliard","fromEmail":"julliard@winehq.org","sentAt":"2008-01-06T11:13:01Z","receivedAt":"2008-01-06T11:13:01Z","isPatch":true,"sender":{"key":"julliard@winehq.org","avatar":null},"body":"This allows displaying correctly the executable flag for the initial\ncommit, and will make it possible to show the file type for up-to-date\nsymlinks and subprojects.\n\nSigned-off-by: Alexandre Julliard <julliard@winehq.org>\n---\n contrib/emacs/git.el |   20 ++++++++++++++++++--\n 1 files changed, 18 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/emacs/git.el b/contrib/emacs/git.el\nindex e0e6316..820df11 100644\n--- a/contrib/emacs/git.el\n+++ b/contrib/emacs/git.el\n@@ -642,6 +642,22 @@ Return the list of files that haven't been handled.\"\n     (git-insert-info-list status infolist)\n     files))\n \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+    (with-temp-buffer\n+      (apply #'git-call-process-env t nil \"ls-files\" \"-z\" \"-s\" \"-c\" \"--\" files)\n+      (goto-char (point-min))\n+      (while (re-search-forward \"\\\\([0-7]\\\\{6\\\\}\\\\) [0-9a-f]\\\\{40\\\\} [0-3]\\t\\\\([^\\0]+\\\\)\\0\" nil t)\n+        (let* ((new-perm (string-to-number (match-string 1) 8))\n+               (old-perm (if (eq default-state 'added) 0 new-perm))\n+               (name (match-string 2)))\n+          (push (git-create-fileinfo default-state name old-perm new-perm) infolist)\n+          (setq files (delete name files)))))\n+    (git-insert-info-list status infolist)\n+    files))\n+\n (defun git-run-ls-unmerged (status files)\n   \"Run git-ls-files -u on FILES and parse the results into STATUS.\"\n   (with-temp-buffer\n@@ -673,10 +689,10 @@ Return the list of files that haven't been handled.\"\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 git-status nil 'uptodate \"-c\")))\n+    (when git-show-uptodate (git-run-ls-files-cached git-status nil 'uptodate)))\n   (let* ((remaining-files\n           (if (git-empty-db-p) ; we need some special handling for an empty db\n-              (git-run-ls-files git-status files 'added \"-c\")\n+              (git-run-ls-files-cached git-status files 'added)\n             (git-run-diff-index git-status files))))\n     (git-run-ls-unmerged git-status files)\n     (when (or remaining-files (and git-show-unknown (not files)))\n-- \n1.5.4.rc2.53.gb6f8\n\n-- \nAlexandre Julliard\njulliard@winehq.org\n"}]}