summaryrefslogtreecommitdiffstats
path: root/gitmirror.sh
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-01-28 19:33:10 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-01-28 19:33:10 +0100
commit3dc333574e9ecb661861a5e55f7f0e119629a4f1 (patch)
treef6e4b0c1b06fc800a8754b24c7495da68383f3c3 /gitmirror.sh
parentInitial commit (diff)
downloadgitmirror-3dc333574e9ecb661861a5e55f7f0e119629a4f1.tar.gz
gitmirror-3dc333574e9ecb661861a5e55f7f0e119629a4f1.tar.zst
gitmirror-3dc333574e9ecb661861a5e55f7f0e119629a4f1.zip
Add script to merge remote patches
Diffstat (limited to 'gitmirror.sh')
-rwxr-xr-xgitmirror.sh12
1 files changed, 5 insertions, 7 deletions
diff --git a/gitmirror.sh b/gitmirror.sh
index 29503d9..53433dc 100755
--- a/gitmirror.sh
+++ b/gitmirror.sh
@@ -22,6 +22,8 @@ read_branches() {
22 done < <(git for-each-ref "${prefix}**" \ 22 done < <(git for-each-ref "${prefix}**" \
23 --format=$'%(refname)\t%(objectname)' \ 23 --format=$'%(refname)\t%(objectname)' \
24 --color=never) 24 --color=never)
25
26 local branch_name
25 for branch_name in "${!read_branches_target[@]}"; do 27 for branch_name in "${!read_branches_target[@]}"; do
26 printf " %*s = %s\n" \ 28 printf " %*s = %s\n" \
27 $((-max_length)) \ 29 $((-max_length)) \
@@ -55,18 +57,14 @@ archive_if_needed() {
55} 57}
56 58
57sync_mirror() { 59sync_mirror() {
58 if (( $# == 0 || $# > 2 )); then 60 if (( $# != 2 )); then
59 echo "Usage: $0 REPOSITORY [REMOTE]" >&2 61 echo "Usage: $0 REPOSITORY [REMOTE]" >&2
60 exit 1 62 exit 1
61 fi 63 fi
62 64
63 local repository="$1" 65 local repository="$1"
64 local remote 66 local remote="$2"
65 if (( $# == 1 )); then 67
66 remote="origin"
67 else
68 remote="$2"
69 fi
70 local archive_prefix 68 local archive_prefix
71 archive_prefix="$(TZ='UTC' printf 'archives/%(%Y%m%dT%H%M%S)TZ/')" 69 archive_prefix="$(TZ='UTC' printf 'archives/%(%Y%m%dT%H%M%S)TZ/')"
72 70