-
Notifications
You must be signed in to change notification settings - Fork 4
/
search
executable file
·41 lines (34 loc) · 1.27 KB
/
search
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
ROOT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}); pwd)
function contain() {
local n=$#
local value=${!n}
for ((i=1;i < $#;i++)) {
if [ "${!i}" == "${value}" ]; then
echo "y"
return 0
fi
}
echo "n"
return 1
}
EXCLUDE_SUBMOD=(external/data external/vxl_src)
FILTER='\.exe$|\.zip$|\.dll$|\.msi$|\.gz$|\.zip$|\.bz2$|\.xz$|\.tgz$|.pdf$|\.png$'
eval SUBMODULES=$(grep path .gitmodules | sed 's/.*= //' | echo \( $(awk '{printf("%s ",$0)}')\))
#IGNORE_SUBMODULES=$(grep path .gitmodules | sed 's/.*= //' | awk '{printf("^%s$|",$0)}')
#IGNORE_SUBMODULES=$(git submodule --quiet foreach 'echo $name' | awk '{printf("^%s$|",$0)}')
#This takes like a second :(
for i in "${SUBMODULES[@]}"; do
IGNORE_SUBMODULES="^${i}"'$|'"${IGNORE_SUBMODULES}"
done
cd ${ROOT_DIR}
git ls-files -oc --exclude-standard | \grep -vE "${IGNORE_SUBMODULES}"'voxel_globe/static_common/|data/world_borders|'"${FILTER}" | awk '{printf("'"`pwd`"'/%s\n", $0)}'
#This is faster than git submodule foreach
for name in "${SUBMODULES[@]}"
do
if [ "$(contain "${EXCLUDE_SUBMOD[@]}" "$name")" == "y" ]; then
continue
fi
cd ${ROOT_DIR}/$name
git ls-files -oc --exclude-standard | \grep -Ev "${FILTER}" | awk '{printf("'"`pwd`"'/%s\n", $0)}'
done