From 269ff235d32dde012c671f258fcbdeba6504144f Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Mon, 29 Nov 2021 11:02:56 +0530 Subject: [PATCH] git-pull-all: Fix failure on non-git directories Signed-off-by: Joseph Nuthalapati --- git-pull-all | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/git-pull-all b/git-pull-all index 6b0de16..78c4000 100755 --- a/git-pull-all +++ b/git-pull-all @@ -7,7 +7,16 @@ (def default-root ".") -(defn list-dirs [root] (filter #(.isDirectory %) (.listFiles (io/file root)))) +(defn has-git-repo + [dir] + (first (filter #(= ".git" %) + (map #(.getName %) + (filter #(.isDirectory %) (.listFiles (io/file dir))))))) + +(defn list-dirs + [root] + (filter #(has-git-repo %) + (filter #(.isDirectory %) (.listFiles (io/file root))))) (defn git-pull [dir] (p/process ["git" "-C" dir "pull" "--rebase"])) -- 2.43.0