-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate-patch.sh
executable file
·55 lines (41 loc) · 1 KB
/
generate-patch.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash -e
REMOTE=$1
BRANCH=$2
source ci/utils.sh
for submodule in $submodules; do
rm -rf _$submodule || :
done
git fetch $REMOTE $BRANCH
git checkout -f $REMOTE/$BRANCH
git reset --hard $REMOTE/$BRANCH
rm -rf $submodules
git submodule init
git submodule update
unsubmodule
git branch -D tmp || :
git checkout -b tmp
for submodule in $submodules; do
mv $submodule _$submodule
done
git fetch origin master
git checkout -f origin/master
git reset --hard origin/master
rm -rf $submodules
git submodule init
git submodule update
unsubmodule
git branch -D tmp2 || :
git checkout -b tmp2
idx=1
for submodule in $submodules; do
DIFF=$(git diff --no-index --patch ${submodule} _${submodule} || :)
if [ -n "$DIFF" ]; then
echo "Found diff for $submodule"
echo "$DIFF" > "000$idx-$submodule.patch"
idx=$((idx+1))
fi
done
git diff --patch tmp2..tmp $(for submodule in $submodules; do echo -n " :!$submodule"; done) > 000$idx-openpilot.patch
for submodule in $submodules; do
rm -rf _$submodule
done