From a2fa38330aafa90e26a572c9178433b8f74aa0e2 Mon Sep 17 00:00:00 2001 From: Astyax Nourel Date: Mon, 20 Dec 2021 12:00:13 +0100 Subject: [PATCH 1/5] updating to fixed version v0.13.1 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8ea3b16..bd5320a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ocamlsf/learn-ocaml:0.12 +FROM ocamlsf/learn-ocaml:0.13.1 USER root RUN apk add coreutils dumb-init py3-pip zip unzip \ From 088266695c792f5a574d41f990f01a43a4f1ac56 Mon Sep 17 00:00:00 2001 From: Astyax NOUREL Date: Wed, 26 Jan 2022 18:10:03 +0100 Subject: [PATCH 2/5] fixing bad return of "find" call --- .gitignore | 1 + program.sh | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd0fb9f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +env.list diff --git a/program.sh b/program.sh index 8fce92c..49acb11 100755 --- a/program.sh +++ b/program.sh @@ -27,27 +27,28 @@ download_repository() { fi } +find_repositories() { + find "$1" -name .git -exec dirname {} \; +} + optimize_sync() { echo "optimizing using git gc" - cd "$SYNC" || error "optimizing_sync: cd $SYNC" || return - DIRS=$(find . -mindepth 4 -maxdepth 4 -type d -not -path "\./\.git*") - for i in $DIRS + for repo in $(find_repositories $SYNC) do - echo "$i" - cd "$i" || error "optimizing_sync: cd $i" || continue + echo "optimizing $repo" + cd "$repo" || error "optimizing_sync: cd $repo" || continue git gc cd - || error "optimizing_sync: cd - (assert false)" || continue done - git gc - cd .. echo "optimizing done" } clone_sync() { rm -rf ${BACKUP:?}/$SYNC echo "cloning sync to avoid concurrency when writing" - find $SYNC -name .git | while read -r repository; do - git clone "$repository" $BACKUP/"$repository" + for repo in $(find_repositories $SYNC) + do + git clone "$repo" $BACKUP/"$repo" done # copy directories which are not repositories yet echo "cp -rn $SYNC $BACKUP/$SYNC" From 49c41a9b2192f260986b3ebd4186b582860dabec Mon Sep 17 00:00:00 2001 From: Astyax NOUREL Date: Sun, 27 Feb 2022 23:07:22 +0100 Subject: [PATCH 3/5] adding user.name config when cloning repositories --- program.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program.sh b/program.sh index 49acb11..362e68a 100755 --- a/program.sh +++ b/program.sh @@ -48,7 +48,7 @@ clone_sync() { echo "cloning sync to avoid concurrency when writing" for repo in $(find_repositories $SYNC) do - git clone "$repo" $BACKUP/"$repo" + git clone --config user.name="Learn-OCaml user" "$repo" $BACKUP/"$repo" done # copy directories which are not repositories yet echo "cp -rn $SYNC $BACKUP/$SYNC" From fb558c05805848c92a714c881ba61b665a99928c Mon Sep 17 00:00:00 2001 From: Astyax NOUREL Date: Sun, 27 Feb 2022 23:41:26 +0100 Subject: [PATCH 4/5] adding upload in case where SIGTERM is handled too early --- program.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/program.sh b/program.sh index 362e68a..ee45e58 100755 --- a/program.sh +++ b/program.sh @@ -77,6 +77,9 @@ watch_upload() { sleep $BEGIN & PIDSLEEP=$! wait $PIDSLEEP + # In case the first sleep is killed + date + upload_repository "$1" while ! [ -f $STOP ] do sleep $INTERVAL & From 65549e79055a046db8ca4e7238b2d6385f24a2b8 Mon Sep 17 00:00:00 2001 From: Astyax NOUREL Date: Tue, 1 Mar 2022 14:29:03 +0100 Subject: [PATCH 5/5] adding user.email config too --- program.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/program.sh b/program.sh index ee45e58..a28b0ce 100755 --- a/program.sh +++ b/program.sh @@ -48,7 +48,10 @@ clone_sync() { echo "cloning sync to avoid concurrency when writing" for repo in $(find_repositories $SYNC) do - git clone --config user.name="Learn-OCaml user" "$repo" $BACKUP/"$repo" + git clone \ + --config user.name="Learn-OCaml user" \ + --config user.email="none@learn-ocaml.org" \ + "$repo" $BACKUP/"$repo" done # copy directories which are not repositories yet echo "cp -rn $SYNC $BACKUP/$SYNC"