Révision 6d91f38e
Ajouté par Julien Enselme il y a environ 10 ans
bin/d7-create-site.sh | ||
---|---|---|
9 | 9 |
######## Exceptions |
10 | 10 |
check_arguments $# 1 "$help" |
11 | 11 |
|
12 |
if ! work_tree_clean ; then
|
|
12 |
if ! `work_tree_clean` ; then
|
|
13 | 13 |
echo "Your work tree is not clean. Solve this before $0 can continue." |
14 | 14 |
exit 2 |
15 | 15 |
fi |
bin/d7-delete-site.sh | ||
---|---|---|
8 | 8 |
|
9 | 9 |
check_arguments $# 1 "$help" |
10 | 10 |
|
11 |
if ! work_tree_clean ; then
|
|
11 |
if ! `work_tree_clean` ; then
|
|
12 | 12 |
echo "Your work tree is not clean. Solve this before $0 can continue." |
13 | 13 |
exit 2 |
14 | 14 |
fi |
bin/git-report.sh | ||
---|---|---|
3 | 3 |
. /users/guest/assos/bin/scripts-config.sh |
4 | 4 |
. /users/guest/assos/bin/scripts-utils.sh |
5 | 5 |
|
6 |
if ! check_if_work_tree_clean ; then
|
|
6 |
if ! `check_if_work_tree_clean` ; then
|
|
7 | 7 |
mail_unclean_work_tree "[git] WORK TREE UNCLEAN" |
8 | 8 |
fi |
9 | 9 |
|
10 | 10 |
git_log=`git log -p --after=yesterday` |
11 |
if [ -n $git_log ] ; then
|
|
11 |
if [ -n "$git_log" ] ; then
|
|
12 | 12 |
echo $git_log | mail -s "[git] Report" |
13 | 13 |
fi |
14 | 14 |
|
bin/scripts-utils.sh | ||
---|---|---|
79 | 79 |
|
80 | 80 |
work_tree_clean() { |
81 | 81 |
git_status_output=`git status --porcelain` |
82 |
if [ -z $git_status_output ] ; then
|
|
82 |
if [ -z "$git_status_output" ] ; then
|
|
83 | 83 |
exit 0 |
84 | 84 |
else |
85 | 85 |
exit 1 |
... | ... | |
89 | 89 |
mail_unclean_work_tree() { |
90 | 90 |
cd $dir_multi_assos |
91 | 91 |
git_status_output=`git status` |
92 |
echo $git_status_output | mail -s $1 $email_multi_assos
|
|
92 |
echo "$git_status_output" | mail -s "$1" $email_multi_assos
|
|
93 | 93 |
} |
94 | 94 |
|
95 | 95 |
commit_if_unclean() { |
96 |
if ! work_tree_clean ; then
|
|
96 |
if ! `work_tree_clean` ; then
|
|
97 | 97 |
commit_message="COMMIT OF UNCLEAN STUFF" |
98 |
commit -a -m $commit_message
|
|
98 |
commit -a -m "$commit_message"
|
|
99 | 99 |
mail_unclean_work_tree "[git] $commit_message" |
100 | 100 |
fi |
101 | 101 |
} |
102 | 102 |
|
103 | 103 |
commit() { |
104 | 104 |
# ARG: commit message |
105 |
if [ -z $1 ] ; then
|
|
105 |
if [ -z "$1" ] ; then
|
|
106 | 106 |
echo "Empty commit message. Nothing was commited." |
107 | 107 |
exit 2 |
108 | 108 |
fi |
109 | 109 |
cd $dir_multi_assos |
110 |
git commit -a -m $1
|
|
110 |
git commit -a -m "$1"
|
|
111 | 111 |
} |
Formats disponibles : Unified diff
Test added for git where posing trouble
We must use
to launch function in a subshell, other wise the whole
script exit with the instruction 'exit 1' or 'exit 0'.
We must use " around variable for test. Otherwise, we get a Unexpected
operator error.