Skip to content

Instantly share code, notes, and snippets.

@xandkar
Created December 19, 2021 05:07
Show Gist options
  • Save xandkar/6b1fd0a8ab0380dcfe1243fa6c7dd536 to your computer and use it in GitHub Desktop.
Save xandkar/6b1fd0a8ab0380dcfe1243fa6c7dd536 to your computer and use it in GitHub Desktop.
(define (find-git-dirs path)
(define (basename path)
(let-values ([(base name must-be-dir?) (split-path path)])
(match name
['same (string->path ".")]
['up (string->path "..")]
[name name])))
(define .git (string->path ".git"))
(find-files
(λ (path)
(and (equal? (file-or-directory-type path) 'directory)
(equal? (basename path) .git)))
path))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment