From 3d3665ee29a6ca1d6ccf87e355f8b4332d372453 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 2 Jul 2016 08:16:38 -0700 Subject: [PATCH] clone.sh/update.sh: detect all git-fast-import mirror packs Do not rely solely on the git fast-import --export-pack-edges option since it's not available with git remote-helpers. Instead automatically detect newly fetched packs when --export-pack-edges is not available and the mirror URL is a known git-fast-import remote-helper mirror URL. Signed-off-by: Kyle J. McKay --- jobd/update.sh | 11 +++++++++++ taskd/clone.sh | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/jobd/update.sh b/jobd/update.sh index e654f1d..4f264a4 100755 --- a/jobd/update.sh +++ b/jobd/update.sh @@ -271,7 +271,18 @@ case "$url" in # Note the git config documentation is wrong # transfer.unpackLimit, if set, overrides fetch.unpackLimit git_add_config 'transfer.unpackLimit=1' + # remember the starting time so we can easily detect new packs for fast-import mirrors + # we sleep for 1 second after creating .gfipack to make sure all packs are newer + if is_gfi_mirror_url "$url" && [ ! -e .gfipack ]; then + rm -f .gfipack + >.gfipack + sleep 1 + fi GIT_SSL_NO_VERIFY=1 bang git remote update $pruneopt + if is_gfi_mirror_url "$url"; then + find objects/pack -type f -newer .gfipack -name "pack-$octet20.pack" -print >>gfi-packs + rm -f .gfipack + fi ;; esac diff --git a/taskd/clone.sh b/taskd/clone.sh index 798466c..4688d94 100755 --- a/taskd/clone.sh +++ b/taskd/clone.sh @@ -390,7 +390,18 @@ case "$url" in # it. We do not support a HEAD symref to anything other than refs/heads/... [ -n "$headref" ] || headref="refs/heads/master" git symbolic-ref HEAD "$headref" + # remember the starting time so we can easily detect new packs for fast-import mirrors + # we sleep for 1 second after creating .gfipack to make sure all packs are newer + if is_gfi_mirror_url "$url" && [ ! -e .gfipack ]; then + rm -f .gfipack + >.gfipack + sleep 1 + fi GIT_SSL_NO_VERIFY=1 git remote update --prune + if is_gfi_mirror_url "$url"; then + find objects/pack -type f -newer .gfipack -name "pack-$octet20.pack" -print >>gfi-packs + rm -f .gfipack + fi else warnempty=1 git symbolic-ref HEAD "refs/heads/master" -- 2.11.4.GIT