Skip to content

Instantly share code, notes, and snippets.

@Fuco1
Created April 12, 2014 06:24
Show Gist options
  • Save Fuco1/10521507 to your computer and use it in GitHub Desktop.
Save Fuco1/10521507 to your computer and use it in GitHub Desktop.
git list files
(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