From 124bc8584e6a551aca4b2d163465c3c30422484d Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Wed, 8 Mar 2023 18:44:03 +0100 Subject: [PATCH] Remove stale references --- pusher | 13 +++++++++++++ updatemodules | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/pusher b/pusher index c8c9325..06e2920 100755 --- a/pusher +++ b/pusher @@ -168,6 +168,19 @@ for m in "${!pq[@]}"; do fi done +for m in "${!rq[@]}"; do + [ "${#modules[@]}" -eq 0 -o -n "${modules[$m]}" ] || continue + if [ -z "${pq[$m]}" ]; then + log_info "delete remote request $m" + if ! git send-pack --force "$push_url" ":refs/heads/update_$m"; then + echo "failed to push $m update" >&2 + ret=1 + continue + fi + did_push=1 + fi +done + if [ -n "$did_push" ]; then log_info "Updating remote $PUSH_REMOTE" git remote update -p "$PUSH_REMOTE" > /dev/null diff --git a/updatemodules b/updatemodules index 6b05c96..c5dd9a5 100755 --- a/updatemodules +++ b/updatemodules @@ -161,6 +161,14 @@ fi declare -A pq makedict pq git for-each-ref 'refs/pq/*' --format '%(refname)' +for r in "${!pq[@]}"; do + m="${r##*/}" + if [ -z "${revs[$m]}" ] && ! isnew "$m" && ! todrop "$m"; then + log_info "remove stale update entry for $m" + git update-ref -d "$r" + fi +done + # check remotes for updates declare -A commits treetext=$(git cat-file -p "$REMOTE/$BASE_BRANCH^{tree}")