-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush
More file actions
42 lines (38 loc) · 923 Bytes
/
push
File metadata and controls
42 lines (38 loc) · 923 Bytes
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
#!/bin/sh
# # 发生了修改、加入到cache
# # if [ "`git st -s`" ];
# git_modify() {
# result=`git st -s`
# if [[ "$result" != "" ]]; then
# echo "git modify"
# return 0
# else
# return 1
# fi
# }
# # 加入到cache
# git_cache() {
# git diff --cached --quiet
# return $?
# }
# # 所有情况:发生了修改、加入到cache、尚未push
# # git diff origin/master --quiet
# git_commit() {
# git diff origin/master --quiet
# return $?
# }
# not in code dir; $1 used for prevent from endless loop
if [ -e ../code/push ] && ! [[ `pwd` =~ .*code$ ]] && [[ $1 != 1 ]]; then
sh ../code/push 1
else
# 1) some data in cache 2) change commit, but have not pushed
if !(git diff origin/master --quiet); then
# only commit when needed
if [ "`git st -s`" ]; then
git add -A .
git ci -m "fix"
fi
git push origin master:master
# result=`git push origin master:master 2>&1 | tee -`
fi
fi