-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathrequest-git-sync.sh
44 lines (30 loc) · 1.11 KB
/
request-git-sync.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
# it3xl.ru git-repo-sync https://github.com/it3xl/git-repo-sync
set -euf +x -o pipefail
echo
echo Start $(basename $BASH_SOURCE)
invoke_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$invoke_path/util/set_env.sh" "$@"
rm -f "$env_modifications_signal_file"
rm -f "$env_modifications_signal_file_a"
rm -f "$env_modifications_signal_file_b"
echo
source "$path_git_sync_util/repo_create.sh"
cd "$path_sync_repo"
source "$path_git_sync_util/restore-after-crash.sh"
source "$path_git_sync_util/change_detector.sh"
echo
if (( $changes_detected == 1 )); then
install -D /dev/null "$env_modifications_signal_file"
install -D /dev/null "$env_modifications_signal_file_a"
install -D /dev/null "$env_modifications_signal_file_b"
# Passing of remote refs to prevent excessive network requesting.
echo "$remote_refs_a" >> "$env_modifications_signal_file_a"
echo "$remote_refs_b" >> "$env_modifications_signal_file_b"
echo '@' RESULT: Synchronization requested.
else
echo '@' RESULT: Refs are the same. Exit.
echo
# exit
fi
echo
echo End $(basename $BASH_SOURCE)