forked from nesges/Widgets-for-fhem-tablet-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commit.sh
executable file
·67 lines (56 loc) · 1.68 KB
/
commit.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
56
57
58
59
60
61
62
63
64
65
66
67
if [ -z "$*" ]
then
echo "Usage: "
echo " commit.sh <commit message>"
exit
fi
echo "-------------------------------------------------------------------------"
echo "Your commit message: $*"
echo ""
echo "-------------------------------------------------------------------------"
echo "The following files would be added to the repository:"
echo ""
git add -A --dry-run
echo ""
echo "-------------------------------------------------------------------------"
echo "The following changes would be committed:"
echo ""
git commit -a -m "$*" --dry-run
if [[ $* =~ ^test$ ]]
then
exit
fi
echo ""
echo "-------------------------------------------------------------------------"
read -p "Proceed to commit? " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "...adding files"
git add -A
echo "...writing CHANGED file"
mv CHANGED _CHANGED
echo $(date +"%Y-%m-%d") > CHANGED
echo " $*" >> CHANGED
cat _CHANGED >> CHANGED
rm _CHANGED
echo "...preparing controlfile"
rm controls_widgets-for-fhem-tablet-ui.txt
find ./www/tablet -type d \( ! -iname ".*" \) -print0 | while IFS= read -r -d '' f;
do
out="DIR $f"
echo ${out//.\//} >> controls_widgets-for-fhem-tablet-ui.txt
done
find ./www -type f \( ! -iname ".*" \) -print0 | while IFS= read -r -d '' f;
do
out="UPD `stat --format "%z %s" $f | sed -e "s#\([0-9-]*\)\ \([0-9:]*\)\.[0-9]*\ [+0-9]*#\1_\2#"` $f"
echo ${out//.\//} >> controls_widgets-for-fhem-tablet-ui.txt
done
echo "...commit changes"
git commit -a -m "$*"
echo "...pull from github"
git pull
echo "...push to github"
git push
fi
echo "done"