{"thread":{"id":"11937","subject":"[PATCH 1/4] git.el: Support for showing unknown/ignored directories.","startedAt":"2008-02-07T12:50:19Z","lastAt":"2008-02-28T07:46:44Z","messageCount":8,"participants":["Alexandre Julliard","Karl Hasselström","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"67787","messageId":"87zludorqs.fsf@wine.dyndns.org","threadId":"11937","inReplyTo":null,"subject":"[PATCH 1/4] git.el: Support for showing unknown/ignored directories.","fromName":"Alexandre Julliard","fromEmail":"julliard@winehq.org","sentAt":"2008-02-07T12:50:19Z","receivedAt":"2008-02-07T12:50:19Z","isPatch":true,"sender":{"key":"julliard@winehq.org","avatar":null},"body":"Instead of recursing into directories that only contain unknown files,\ndisplay only the directory itself. Its contents can be expanded with\ngit-find-file (bound to C-m).\n\nSigned-off-by: Alexandre Julliard <julliard@winehq.org>\n---\n contrib/emacs/git.el |   38 +++++++++++++++++++++++++++++---------\n 1 files changed, 29 insertions(+), 9 deletions(-)\n\ndiff --git a/contrib/emacs/git.el b/contrib/emacs/git.el\nindex d8a0638..58d72a5 100644\n--- a/contrib/emacs/git.el\n+++ b/contrib/emacs/git.el\n@@ -558,12 +558,15 @@ and returns the process output as a string.\"\n \t\t     (?\\100 \"   (type change file -> subproject)\")\n \t\t     (?\\120 \"   (type change symlink -> subproject)\")\n \t\t     (t \"   (subproject)\")))\n+                  (?\\110 nil)  ;; directory (internal, not a real git state)\n \t\t  (?\\000  ;; deleted or unknown\n \t\t   (case old-type\n \t\t     (?\\120 \"   (symlink)\")\n \t\t     (?\\160 \"   (subproject)\")))\n \t\t  (t (format \"   (unknown type %o)\" new-type)))))\n-    (if str (propertize str 'face 'git-status-face) \"\")))\n+    (cond (str (propertize str 'face 'git-status-face))\n+          ((eq new-type ?\\110) \"/\")\n+          (t \"\"))))\n \n (defun git-rename-as-string (info)\n   \"Return a string describing the copy or rename associated with INFO, or an empty string if none.\"\n@@ -666,9 +669,11 @@ Return the list of files that haven't been handled.\"\n     (with-temp-buffer\n       (apply #'git-call-process-env t nil \"ls-files\" \"-z\" (append options (list \"--\") files))\n       (goto-char (point-min))\n-      (while (re-search-forward \"\\\\([^\\0]*\\\\)\\0\" nil t 1)\n+      (while (re-search-forward \"\\\\([^\\0]*?\\\\)\\\\(/?\\\\)\\0\" nil t 1)\n         (let ((name (match-string 1)))\n-          (push (git-create-fileinfo default-state name) infolist)\n+          (push (git-create-fileinfo default-state name 0\n+                                     (if (string-equal \"/\" (match-string 2)) (lsh ?\\110 9) 0))\n+                infolist)\n           (setq files (delete name files)))))\n     (git-insert-info-list status infolist)\n     files))\n@@ -713,7 +718,7 @@ Return the list of files that haven't been handled.\"\n (defun git-run-ls-files-with-excludes (status files default-state &rest options)\n   \"Run git-ls-files on FILES with appropriate --exclude-from options.\"\n   (let ((exclude-files (git-get-exclude-files)))\n-    (apply #'git-run-ls-files status files default-state\n+    (apply #'git-run-ls-files status files default-state \"--directory\"\n            (concat \"--exclude-per-directory=\" git-per-dir-ignore-file)\n            (append options (mapcar (lambda (f) (concat \"--exclude-from=\" f)) exclude-files)))))\n \n@@ -957,6 +962,7 @@ Return the list of files that haven't been handled.\"\n   \"Add marked file(s) to the index cache.\"\n   (interactive)\n   (let ((files (git-get-filenames (git-marked-files-state 'unknown 'ignored))))\n+    ;; FIXME: add support for directories\n     (unless files\n       (push (file-relative-name (read-file-name \"File to add: \" nil nil t)) files))\n     (apply #'git-call-process-env nil nil \"update-index\" \"--add\" \"--\" files)\n@@ -983,7 +989,10 @@ Return the list of files that haven't been handled.\"\n          (format \"Remove %d file%s? \" (length files) (if (> (length files) 1) \"s\" \"\")))\n         (progn\n           (dolist (name files)\n-            (when (file-exists-p name) (delete-file name)))\n+            (ignore-errors\n+              (if (file-directory-p name)\n+                  (delete-directory name)\n+                (delete-file name))))\n           (apply #'git-call-process-env nil nil \"update-index\" \"--remove\" \"--\" files)\n           (git-update-status-files files nil)\n           (git-success-message \"Removed\" files))\n@@ -992,7 +1001,7 @@ Return the list of files that haven't been handled.\"\n (defun git-revert-file ()\n   \"Revert changes to the marked file(s).\"\n   (interactive)\n-  (let ((files (git-marked-files))\n+  (let ((files (git-marked-files-state 'added 'deleted 'modified 'unmerged))\n         added modified)\n     (when (and files\n                (yes-or-no-p\n@@ -1063,6 +1072,16 @@ Return the list of files that haven't been handled.\"\n         (message \"Inserting unknown files...done\"))\n     (git-remove-handled)))\n \n+(defun git-expand-directory (info)\n+  \"Expand the directory represented by INFO to list its files.\"\n+  (when (eq (lsh (git-fileinfo->new-perm info) -9) ?\\110)\n+    (let ((dir (git-fileinfo->name info)))\n+      (git-set-filenames-state git-status (list dir) nil)\n+      (git-run-ls-files-with-excludes git-status (list (concat dir \"/\")) 'unknown \"-o\")\n+      (git-refresh-files)\n+      (git-refresh-ewoc-hf git-status)\n+      t)))\n+\n (defun git-setup-diff-buffer (buffer)\n   \"Setup a buffer for displaying a diff.\"\n   (let ((dir default-directory))\n@@ -1237,9 +1256,10 @@ Return the list of files that haven't been handled.\"\n   (interactive)\n   (unless git-status (error \"Not in git-status buffer.\"))\n   (let ((info (ewoc-data (ewoc-locate git-status))))\n-    (find-file (git-fileinfo->name info))\n-    (when (eq 'unmerged (git-fileinfo->state info))\n-      (smerge-mode 1))))\n+    (unless (git-expand-directory info)\n+      (find-file (git-fileinfo->name info))\n+      (when (eq 'unmerged (git-fileinfo->state info))\n+        (smerge-mode 1)))))\n \n (defun git-find-file-other-window ()\n   \"Visit the current file in its own buffer in another window.\"\n-- \n1.5.4.38.g0d380\n\n-- \nAlexandre Julliard\njulliard@winehq.org\n"},{"id":"69586","messageId":"20080222153051.GA20984@diana.vm.bytemark.co.uk","threadId":"11937","inReplyTo":"87zludorqs.fsf@wine.dyndns.org","subject":"Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-02-22T15:30:51Z","receivedAt":"2008-02-22T15:30:51Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-02-07 13:50:19 +0100, Alexandre Julliard wrote:\n\n> Instead of recursing into directories that only contain unknown\n> files, display only the directory itself. Its contents can be\n> expanded with git-find-file (bound to C-m).\n\nI have a bunch of directories in my tree with only ignored files in\nthem. They used to not show up at all, but now they do. If I press\nreturn with the cursor on top of one of them, it vanishes (which is\nequivalent to expanding to all the 0 non-ignored files in that\ndirectory, I guess).\n\nI presume this wasn't the intended behavior? I like the idea for\nsubdirectories that actually contain non-ignored files, but\ndirectories with only ignored files should really not be shown at all.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"69587","messageId":"8763whkmxf.fsf@wine.dyndns.org","threadId":"11937","inReplyTo":"20080222153051.GA20984@diana.vm.bytemark.co.uk","subject":"Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.","fromName":"Alexandre Julliard","fromEmail":"julliard@winehq.org","sentAt":"2008-02-22T15:53:16Z","receivedAt":"2008-02-22T15:53:16Z","isPatch":true,"sender":{"key":"julliard@winehq.org","avatar":null},"body":"Karl Hasselström <kha@treskal.com> writes:\n\n> On 2008-02-07 13:50:19 +0100, Alexandre Julliard wrote:\n>\n>> Instead of recursing into directories that only contain unknown\n>> files, display only the directory itself. Its contents can be\n>> expanded with git-find-file (bound to C-m).\n>\n> I have a bunch of directories in my tree with only ignored files in\n> them. They used to not show up at all, but now they do. If I press\n> return with the cursor on top of one of them, it vanishes (which is\n> equivalent to expanding to all the 0 non-ignored files in that\n> directory, I guess).\n>\n> I presume this wasn't the intended behavior? I like the idea for\n> subdirectories that actually contain non-ignored files, but\n> directories with only ignored files should really not be shown at all.\n\nIt probably needs something like this:\n\nFrom b32a397a64eec64d433aa0ee00147003723cfeee Mon Sep 17 00:00:00 2001\nFrom: Alexandre Julliard <julliard@winehq.org>\nDate: Fri, 22 Feb 2008 16:48:53 +0100\nSubject: [PATCH] git.el: Do not display empty directories.\n\nSigned-off-by: Alexandre Julliard <julliard@winehq.org>\n---\n contrib/emacs/git.el |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/emacs/git.el b/contrib/emacs/git.el\nindex d91fbb8..7cb86df 100644\n--- a/contrib/emacs/git.el\n+++ b/contrib/emacs/git.el\n@@ -753,7 +753,7 @@ Return the list of files that haven't been handled.\"\n (defun git-run-ls-files-with-excludes (status files default-state &rest options)\n   \"Run git-ls-files on FILES with appropriate --exclude-from options.\"\n   (let ((exclude-files (git-get-exclude-files)))\n-    (apply #'git-run-ls-files status files default-state \"--directory\"\n+    (apply #'git-run-ls-files status files default-state \"--directory\" \"--no-empty-directory\"\n            (concat \"--exclude-per-directory=\" git-per-dir-ignore-file)\n            (append options (mapcar (lambda (f) (concat \"--exclude-from=\" f)) exclude-files)))))\n \n-- \n1.5.4.1.132.gd85f75\n\n-- \nAlexandre Julliard\njulliard@winehq.org\n"},{"id":"69592","messageId":"20080222171052.GA23012@diana.vm.bytemark.co.uk","threadId":"11937","inReplyTo":"8763whkmxf.fsf@wine.dyndns.org","subject":"Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-02-22T17:10:52Z","receivedAt":"2008-02-22T17:10:52Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-02-22 16:53:16 +0100, Alexandre Julliard wrote:\n\n> Karl Hasselström <kha@treskal.com> writes:\n>\n> > I have a bunch of directories in my tree with only ignored files\n> > in them. They used to not show up at all, but now they do.\n>\n> It probably needs something like this:\n\nThat fixed the problem. Thanks!\n\n> Signed-off-by: Alexandre Julliard <julliard@winehq.org>\n\nTested-by: Karl Hasselström <kha@treskal.com>\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"70079","messageId":"20080227112746.GA10786@diana.vm.bytemark.co.uk","threadId":"11937","inReplyTo":"20080222171052.GA23012@diana.vm.bytemark.co.uk","subject":"Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-02-27T11:27:46Z","receivedAt":"2008-02-27T11:27:46Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-02-22 18:10:52 +0100, Karl Hasselström wrote:\n\n> On 2008-02-22 16:53:16 +0100, Alexandre Julliard wrote:\n>\n> > Karl Hasselström <kha@treskal.com> writes:\n> >\n> > > I have a bunch of directories in my tree with only ignored files\n> > > in them. They used to not show up at all, but now they do.\n> >\n> > It probably needs something like this:\n>\n> That fixed the problem. Thanks!\n>\n> > Signed-off-by: Alexandre Julliard <julliard@winehq.org>\n>\n> Tested-by: Karl Hasselström <kha@treskal.com>\n\nJunio, did you see this bugfix? (I just realized you weren't cc'ed, so\nI guess not.)\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"70151","messageId":"7vejaytc35.fsf@gitster.siamese.dyndns.org","threadId":"11937","inReplyTo":"20080227112746.GA10786@diana.vm.bytemark.co.uk","subject":"Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-27T19:48:30Z","receivedAt":"2008-02-27T19:48:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karl Hasselström <kha@treskal.com> writes:\n\n> On 2008-02-22 18:10:52 +0100, Karl Hasselström wrote:\n> ...\n>> That fixed the problem. Thanks!\n>>\n>> > Signed-off-by: Alexandre Julliard <julliard@winehq.org>\n>>\n>> Tested-by: Karl Hasselström <kha@treskal.com>\n>\n> Junio, did you see this bugfix? (I just realized you weren't cc'ed, so\n> I guess not.)\n\nNo, and thanks.\n\nSo I'll take\n\n    From: Alexandre Julliard <julliard@winehq.org>\n    Message-ID: <8763whkmxf.fsf@wine.dyndns.org>\n    \naka\n\n    http://article.gmane.org/gmane.comp.version-control.git/74730\n\nin this thread with your Tested-by: and apply to fix 3f3d564\n(git.el: Support for showing unknown/ignored directories.)?\n"},{"id":"70218","messageId":"20080228070611.GA28085@diana.vm.bytemark.co.uk","threadId":"11937","inReplyTo":"7vejaytc35.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-02-28T07:06:11Z","receivedAt":"2008-02-28T07:06:11Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-02-27 11:48:30 -0800, Junio C Hamano wrote:\n\n> Karl Hasselström <kha@treskal.com> writes:\n>\n> > Junio, did you see this bugfix? (I just realized you weren't\n> > cc'ed, so I guess not.)\n>\n> No, and thanks.\n>\n> So I'll take\n>\n>     From: Alexandre Julliard <julliard@winehq.org>\n>     Message-ID: <8763whkmxf.fsf@wine.dyndns.org>\n>\n> aka\n>\n>     http://article.gmane.org/gmane.comp.version-control.git/74730\n>\n> in this thread with your Tested-by: and apply to fix 3f3d564\n> (git.el: Support for showing unknown/ignored directories.)?\n\nYes, exactly. Thanks.\n\n(Would you like this kind of detailed pointer in a reminder, or is the\nthreading support in your mailer good enough that just replying to the\nright mail will do it?)\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"70220","messageId":"7v3ardldzv.fsf@gitster.siamese.dyndns.org","threadId":"11937","inReplyTo":"20080228070611.GA28085@diana.vm.bytemark.co.uk","subject":"Re: [PATCH 1/4] git.el: Support for showing unknown/ignored directories.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-28T07:46:44Z","receivedAt":"2008-02-28T07:46:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karl Hasselström <kha@treskal.com> writes:\n\n> (Would you like this kind of detailed pointer in a reminder, or is the\n> threading support in your mailer good enough that just replying to the\n> right mail will do it?)\n\nI'd actually like a forwarded message that I can directly feed\nto \"git am\", with Sign-offs and Acked-bys, but being explicit\nwould be good enough.\n\nI often do not have enough mental and time bandwidth to hunt for\nmessages more than 2 weeks old in the list archive, so unless\nthe response is direct reply to the original, I'd rather not\nrely on the threading feature. IOW, I can move to grandparent by\ntyping ^ just fine, but uncles and aunts are harder to find\nwithout reloading my MUA full message archive for N weeks worth.\n"}]}