Add --notor option

This commit is contained in:
Midgard 2020-09-15 12:06:33 +02:00
parent f5592f3796
commit 90b991f407
Signed by: midgard
GPG key ID: 511C112F1331BBB4
2 changed files with 17 additions and 4 deletions

View file

@ -36,8 +36,11 @@ use cron for this, or write a system service definition for your system supervis
systemd, OpenRC or runit). systemd, OpenRC or runit).
## Tor ## Tor
The leader is fetched over Tor through torify. Make sure Tor is running, or edit the script, Unless the option `--notor` is used, the leader is fetched over Tor through torify. Make sure Tor
changing `torify git fetch` into `git fetch`. is running, or pass `--notor` to the script, like so:
```bash
./git-mirror.sh ~/git-mirror-my-repo github gitea gitlab
```
## Motivation ## Motivation
GitHub has always been hypocritical, promoting open source while keeping its own stack closed. When GitHub has always been hypocritical, promoting open source while keeping its own stack closed. When

View file

@ -18,10 +18,16 @@ set -euo pipefail
IFS=$'\n' IFS=$'\n'
if [[ $# -lt 3 ]]; then if [[ $# -lt 3 ]]; then
echo "Usage: $0 <workdir> <leader> <follower...>" echo "Usage: $0 [--notor] <workdir> <leader> <follower...>"
exit 1 exit 1
fi fi
tor=true
if [[ "$1" == "--notor" ]]; then
tor=false
shift 1
fi
cd "$1" cd "$1"
leader="$2" leader="$2"
@ -33,7 +39,11 @@ echo "Leader remote: $leader"
echo "Follower remotes: ${followers[*]}" | tr '\n' ' ' echo "Follower remotes: ${followers[*]}" | tr '\n' ' '
echo; echo echo; echo
torify git fetch --prune --multiple "$leader" if [[ $tor == true ]]; then
torify git fetch --prune --multiple "$leader"
else
git fetch --prune --multiple "$leader"
fi
git fetch --prune --multiple "${followers[@]}" git fetch --prune --multiple "${followers[@]}"
echo echo