-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-push-to-git.sh
More file actions
executable file
·73 lines (58 loc) · 1.35 KB
/
run-push-to-git.sh
File metadata and controls
executable file
·73 lines (58 loc) · 1.35 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
#
# Copyright © 2023 Chee Bin HOH. All rights reserved.
#
# It combines the following steps into one shell script:
# - remove padding space and detect files with tab at start of lines
# - make all to catch build error
# - make clean to remove binary object and executable files
# - clang-format files to be committed (in directory and file extension
# configured via DIRS_SOURCES file)
# - git add changes
# - git commit changes
# - git push changes
buildTest=""
commitMessage=""
while [ "$1" != "" ]; do
case "$1" in
-t)
buildTest="yes"
shift
;;
-m)
shift
commitMessage="$1"
shift
esac
done
oldpwd=$PWD
rootdir=`dirname $0`
if [ $rootdir != "" ]; then
cd $rootdir
fi
. ${rootdir}/run-clang-format.sh
# test build, we do not want to check in things that break
if [ "${buildTest}" == "yes" ]; then
echo "******** run build..."
if [ ! -d ./Build ]; then
mkdir ./Build
fi
cd ./Build
cmake ../
make
echo "******** run ctest..."
ctest -L dmn
# clean up build, we do not want to check in binary
echo "******** clean up build..."
make clean
cd ../
fi
# git activities
echo "******** git add, commit and push..."
echo
git add .
git commit -m "${commitMessage:-"no comment"}"
git push origin `git branch | grep '^*' | sed -e 's/\*//g'` --force
if [ $rootdir != "" ]; then
cd $oldpwd;
fi