-
Notifications
You must be signed in to change notification settings - Fork 129
/
update.sh
executable file
·37 lines (29 loc) · 964 Bytes
/
update.sh
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
#!/bin/bash
READTREE_REPO=("sds_wallpad")
DIRS=`ls -d ./*/|sed 's/\.//g'|sed 's/\///g'`
in_array() {
local needle array value
needle="${1}"; shift; array=("${@}")
for value in ${array[@]}; do [ "${value}" == "${needle}" ] && echo "true" && return; done
echo "false"
}
for i in ${DIRS};do
echo "$i";
array_check=`in_array $i ${READTREE_REPO[@]}`
if [ "${array_check}" == "true" ]; then
result=`git diff $i/master:$i/config.json $i/config.json`
if [[ -n $result ]];then
echo `rm -rf $i`
echo `git add -A`
echo `git commit -m $i" deleted"`
echo `git read-tree --prefix=$i -u $i:$i`
echo `git commit -m $i" refreshed"`
echo -e "<<<<<<<<<<<<<<<<<<< read-tree\n"
else
echo -e ">>>>>>>>>>>>>>>>>>> NO UPDATE\n"
fi
else
echo `git subtree pull --prefix=$i $i master`
echo -e "<<<<<<<<<<<<<<<<<<< subtree\n"
fi
done