Skip to content

Instantly share code, notes, and snippets.

@travisbhartwell
Created January 27, 2009 06:52
Show Gist options
  • Save travisbhartwell/53216 to your computer and use it in GitHub Desktop.
Save travisbhartwell/53216 to your computer and use it in GitHub Desktop.
(defun find-git-repos-internal (dir found-dirs)
(cond ((file-directory-p dir)
(or (char-equal ?/ (aref dir(1- (length dir))))
(setq dir (file-name-as-directory dir)))
(let ((lst (directory-files dir nil nil t))
fullname file)
(while lst
(setq file (car lst))
(setq lst (cdr lst))
(setq fullname (concat dir file))
(cond ((member file '("." "..")))
((file-exists-p (concat fullname "/.git"))
(message "Found a git directory at %s" fullname)
(message "directories so far: %s" found-dirs)
(setq found-dirs (add-to-list 'found-dirs fullname)))
(t
(find-git-repos-internal fullname found-dirs))))))
(t
(message "Directories: %s" found-dirs)
found-dirs)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment