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).
## Tor
The leader is fetched over Tor through torify. Make sure Tor is running, or edit the script,
changing `torify git fetch` into `git fetch`.
Unless the option `--notor` is used, the leader is fetched over Tor through torify. Make sure Tor
is running, or pass `--notor` to the script, like so:
```bash
./git-mirror.sh ~/git-mirror-my-repo github gitea gitlab
```
## Motivation
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'
if [[ $# -lt 3 ]]; then
echo "Usage: $0 <workdir> <leader> <follower...>"
echo "Usage: $0 [--notor] <workdir> <leader> <follower...>"
exit 1
fi
tor=true
if [[ "$1" == "--notor" ]]; then
tor=false
shift 1
fi
cd "$1"
leader="$2"
@ -33,7 +39,11 @@ echo "Leader remote: $leader"
echo "Follower remotes: ${followers[*]}" | tr '\n' ' '
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[@]}"
echo