-
Notifications
You must be signed in to change notification settings - Fork 2
/
entrypoint.sh
executable file
·55 lines (42 loc) · 1.34 KB
/
entrypoint.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
name=$1
email=$2
message=$3
apt-get update
apt-get install -y curl
# keep in method to avoid parameter mingling
apply_style(){
find . -name '*.h' -or -name '*.hpp' -or -name '*.cpp' | xargs clang-format-3.8 -i -style=file $1
}
curl -1sLf \
'https://dl.cloudsmith.io/public/automodality/public/cfg/setup/bash.deb.sh' \
| bash
apt-get install -y \
libllvm3.8 \
clang-format-3.8 \
git
# according to docs, the --style=file will find the .clang-file at the root placed by the Dockerfile copy
# https://releases.llvm.org/3.8.0/tools/clang/docs/ClangFormat.html
# Use -style=file to load style configuration from
# .clang-format file located in one of the parent
# directories of the source file (or current
# directory for stdin).
echo "======================="
echo "Applying style to files"
echo "======================="
apply_style
modified_files=$(git status | grep modified)
if [[ $? == 0 ]] ;then
echo $modified_files
echo
echo "============================"
echo "Committing to Current Branch"
echo "============================"
git config --global user.email "$email"
git config --global user.name "$name"
git config --global push.default current
git commit -a -m "$message"
git push
else
echo "No changes to commit"
fi