-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun.sh
85 lines (34 loc) · 1.2 KB
/
run.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
set -euf +x -o pipefail
echo
echo Start `basename $0`
invoke_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$invoke_path"/set_env.sh "$@"
echo
bash "$path_git_sync"/repo_create.sh "$path_1"
bash "$path_git_sync"/repo_create.sh "$path_2"
source "$path_git_sync"/changes_detector.sh
# Must use the source command here because it's impossible in bash to export array variables to subscripts.
source "$path_git_sync"/fetching.sh
source "$path_git_sync"/deletion.sh
if [[ $deletion_allowed = 1 ]]; then
echo '@' 'Deletion (& partial recovering & sync)'
cd "$path_1"
git push --prune $url_2 "${refspec_del_1[@]}" || true
cd "$path_2"
git push --prune $url_1 "${refspec_del_2[@]}" || true
source "$path_git_sync"/fetching.sh
fi
echo
echo '@ Sync & recovering. Fast-forward. Conventional refs'
cd "$path_1"
git push "$url_2" "${refspec_sync[@]}" || true
cd "$path_2"
git push "$url_1" "${refspec_sync[@]}" || true
source "$path_git_sync"/fetching.sh
echo
echo '@ Conflict resolving (conventional refs).'
cd "$path_1"
git push "$url_2" "${refspec_solve_1[@]}" || true
cd "$path_2"
git push "$url_1" "${refspec_solve_2[@]}" || true
echo End `basename $0`