]> git.phdru.name Git - git-scripts.git/blobdiff - locate-all
Feat(locate-all): Exclude submodules
[git-scripts.git] / locate-all
index 9521272cd9e8f0321d594e4f08e002edc129bf58..841721ea07bbffd902f1278e6c0ab16d372cd2dc 100755 (executable)
@@ -1,4 +1,13 @@
 #! /bin/sh
-locate -b \*.git | sed 's!/\.git$!!' |
+locate -b \*.git |
    grep -v "/archive/SQLObject/\|/archive/cheetah3/\|/third-party/\|$HOME/tmp/" |
-   sort | uniq > locate-all.list
+   while read path; do
+      if [ -d "$path" ]; then # skip files `.git` - they're submodules
+         if [ "`basename \"$path\"`" = .git ]; then
+            dirname "$path"
+         else
+            echo "$path"
+         fi
+      fi
+   done |
+   LC_ALL=C sort | uniq > locate-all.list