diff options
| author | Louis Burda <dev@sinitax.com> | 2025-11-14 21:49:13 +0100 |
|---|---|---|
| committer | Louis Burda <dev@sinitax.com> | 2025-11-14 21:49:13 +0100 |
| commit | fdb21dc20f8eea296909c1b90b1646749e0e9df4 (patch) | |
| tree | a5fa424971b6328d7c2b751fd48a046af10703a4 | |
| parent | 6462d6102e8671d15762eae9dac464d3527dc795 (diff) | |
| download | git-sync-fdb21dc20f8eea296909c1b90b1646749e0e9df4.tar.gz git-sync-fdb21dc20f8eea296909c1b90b1646749e0e9df4.zip | |
Report error code and dont start all the watchers at the same time
| -rwxr-xr-x | git-sync | 15 | ||||
| -rwxr-xr-x | git-syncd | 1 |
2 files changed, 10 insertions, 6 deletions
@@ -335,8 +335,9 @@ fi # TODO make fetching/pushing optional __log_msg "Fetching from $remote_name/$branch_name" git fetch $remote_name $branch_name -if [ $? != 0 ] ; then - __log_msg "git fetch $remote_name returned non-zero. Likely a network problem; exiting." +rc=$? +if [ $rc != 0 ] ; then + __log_msg "git fetch $remote_name returned non-zero ($rc). Likely a network problem; exiting." exit 3 fi @@ -351,20 +352,22 @@ case "$(sync_state)" in "ahead") __log_msg "Pushing changes..." git push $remote_name $branch_name:$branch_name - if [ $? == 0 ]; then + rc=$? + if [ $rc == 0 ]; then exit_assuming_sync else - __log_msg "git push returned non-zero. Likely a connection failure." + __log_msg "git push returned non-zero ($rc). Likely a connection failure." exit 3 fi ;; "behind") __log_msg "We are behind, fast-forwarding..." git merge --ff --ff-only $remote_name/$branch_name - if [ $? == 0 ]; then + rc=$? + if [ $rc == 0 ]; then exit_assuming_sync else - __log_msg "git merge --ff --ff-only returned non-zero ($?). Exiting." + __log_msg "git merge --ff --ff-only returned non-zero ($rc). Exiting." exit 2 fi ;; @@ -86,6 +86,7 @@ start_watchers() { for repo in "${git_syncd_repos[@]}"; do echo "watching '$repo'.." $git_syncd watch "$repo" & + sleep 1 # wait a bit git_syncd_watchers+=($!) done } |
