From f1c20f51dd6cadf36f4a39d21e01453e103aa077 Mon Sep 17 00:00:00 2001 From: Hippolyte Chauvin Date: Fri, 1 Dec 2023 14:26:47 +0100 Subject: [PATCH] =?UTF-8?q?updateall=20:=20parall=C3=A9lisation=20du=20scr?= =?UTF-8?q?ipt=20git?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/updateall/scripts/70-git | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/config/updateall/scripts/70-git b/config/updateall/scripts/70-git index fcee02e..56502b6 100755 --- a/config/updateall/scripts/70-git +++ b/config/updateall/scripts/70-git @@ -1,12 +1,18 @@ #!/bin/sh -if cd ~/git; then - for repo in *; do - cd "$repo" || continue - printf '\n%s\n' "$repo" - git pull - cd .. - done -else - >&2 echo "Can't find your git folder!" -fi +update_repo() { + cd "$1" || return + printf 'Updating repository \033[1m%s\033[0m...\n' "$1" + git pull +} + +cd ~/git || exit + +for i in *; do + while [ "$(jobs -p | wc -l)" -ge 4 ]; do + sleep 1 + done + update_repo "$i" & +done + +wait