Created
April 12, 2014 06:24
-
-
Save Fuco1/10521507 to your computer and use it in GitHub Desktop.
git list files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-dired-insert-git-ls-files (path) | |
(let* ((full-path (file-truename path)) | |
(default-directory path) | |
(buf (with-current-buffer (get-buffer-create " git-ls-files") | |
(erase-buffer) | |
(current-buffer)))) | |
(call-process "git" | |
nil | |
buf | |
nil | |
"ls-files") | |
(let* ((data (with-current-buffer buf | |
(goto-char (point-min)) | |
(when (> (point-max) 0) | |
(insert "\"") | |
(end-of-line) | |
(insert "\"") | |
(while (and (= 0 (forward-line)) | |
(not (eobp))) | |
(insert "\"") | |
(end-of-line) | |
(insert "\""))) | |
(goto-char (point-min)) | |
(replace-regexp "\n" " ") | |
(goto-char (point-min)) | |
(insert "(") | |
(goto-char (point-max)) | |
(insert ")") | |
(buffer-substring-no-properties (point-min) (point-max)))) | |
(list (read data))) | |
(message "%S" list) | |
(--map (insert-directory it "-la") list)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment