diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-18 19:27:03 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-18 19:27:03 -0500 |
| commit | 5cd7ca13005680b3e7bdac48dedf9cfbbfbcaa59 (patch) | |
| tree | bf3de6318e94ead788721ae5fcca0252d00345b6 /modules | |
| parent | 5f4e041fc1db94a7c426d06cd02ad57110fa3972 (diff) | |
| download | dotemacs-5cd7ca13005680b3e7bdac48dedf9cfbbfbcaa59.tar.gz dotemacs-5cd7ca13005680b3e7bdac48dedf9cfbbfbcaa59.zip | |
fix: make this function recursive
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/reconcile-open-repos.el | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/modules/reconcile-open-repos.el b/modules/reconcile-open-repos.el index 22250a55..0cbe6c53 100644 --- a/modules/reconcile-open-repos.el +++ b/modules/reconcile-open-repos.el @@ -73,16 +73,26 @@ Magit for review." ;; ---------------------------- Check For Open Work ---------------------------- +(defun cj/find-git-repos (directory) + "Recursively find all git repositories under DIRECTORY. +Returns a list of directory paths that contain a .git subdirectory." + (let (repos) + (dolist (child (directory-files directory t "^[^.]+$" 'nosort)) + (when (file-directory-p child) + (if (file-directory-p (expand-file-name ".git" child)) + (push child repos) + (setq repos (nconc repos (cj/find-git-repos child)))))) + repos)) + (defun cj/check-for-open-work () "Check all project directories for open work." (interactive) ;; these are constants defined in init.el - ;; children of these directories will be checked + ;; recursively find and check all git repos under these directories (dolist (base-dir (list projects-dir code-dir)) (when (and (boundp 'base-dir) base-dir (file-directory-p base-dir)) - (dolist (child-dir (directory-files base-dir t "^[^.]+$" 'nosort)) - (when (file-directory-p child-dir) - (cj/reconcile-git-directory child-dir))))) + (dolist (repo (cj/find-git-repos base-dir)) + (cj/reconcile-git-directory repo)))) ;; check these directories individually (when (and (boundp 'org-dir) org-dir (file-directory-p org-dir)) |
