chiark / gitweb /
Fix a formatting problem in --build-products-dir= doc.
[dgit.git] / infra / dgit-mirror-rsync
index 2858047b57f85307085c1df13f0448d69e29473e..0d29ffb3e65621b3fec1f468bd0d64c5d90f3772 100755 (executable)
@@ -26,7 +26,7 @@ set -o pipefail
 shopt -s nullglob
 
 case "$DGIT_DRS_DEBUG" in
-''|0!1)                ;;
+''|0|1)                ;;
 *)             set -x  ;;
 esac
 
@@ -105,13 +105,17 @@ lock-and-process () {
 }
 
 attempt () {
-       exec >"$queue/$package.err" 2>&1
+       exec 3>&2 >"$queue/$package.err" 2>&1
        if actually; then
                rm -f "$queue/$package.a"
+               exec 2>&3 2>&1
                mv -f "$queue/$package.err" "$queue/$package.log"
+               if ! [ -s "$queue/$package.log" ]; then
+                       rm "$queue/$package.log"
+               fi
                rm "$queue/$package.lock"
        else
-               cat >&2 "$queue/$package.err"
+               cat >&3 "$queue/$package.err"
                exit 127
        fi
 }
@@ -146,13 +150,13 @@ reinvoke-locked)
 
 backlog)
        for f in $queue/*.[na]; do
-               lock-and-process-baseof-f
+               (lock-and-process-baseof-f ||:)
        done
        ;;
 
 all)
        for f in [a-z0-9]*.git; do
-               lock-and-process-baseof-f
+               (lock-and-process-baseof-f)
        done
        ;;