commit 1d063c9d8b4c6770912abf7077b3053fcacdcbe9 from: Benjamin Stürz date: Wed Dec 27 23:34:59 2023 UTC got-archive-all: skip existing tarballs, if -f was not specified commit - e68d855946d9c32185381174abd4cf13b733a49f commit + 1d063c9d8b4c6770912abf7077b3053fcacdcbe9 blob - 402a7ba1b83797447f45932299ebb64f0a102817 blob + 3567dcf2df596dea1c77f6199a104f66664d2159 --- got-archive-all +++ got-archive-all @@ -8,18 +8,25 @@ die() { } usage() { - die 1 "Usage: got-archive-all [-sV] [-o outdir] [-t tmpdir] prefix" + die 1 "Usage: got-archive-all [-fsV] [-o outdir] [-t tmpdir] prefix" } -args=$(getopt o:st:V $*) +args=$(getopt fo:st:V $*) [ $? -ne 0 ] && usage set -- $args +force=0 +outdir=. flags= while [ $# -ne 0 ]; do case "$1" in + -f) + force=1 + shift + ;; -o) + outdir=$2 flags="$flags -o $2" shift shift @@ -48,14 +55,15 @@ done prefix=$1 -printf 'flags=%s\n' "$flags" - for repo in "$prefix"/*.git; do [ -d "$repo/refs/tags" ] || continue + name=$(basename "$repo" .git) + for tag in "$repo"/refs/tags/*; do tag=$(basename "$tag") - - got-archive $flags -b "$tag" "$repo" + if [ ! -e "$outdir/$name-$tag.tgz" ] || [ "$force" = 1 ]; then + got-archive $flags -b "$tag" "$repo" + fi done done blob - e20a780fc790c6d9bff0126efee49cc9c79c610e blob + ade310647577a32a9c771e9b79ee7fd4b2ca9a34 --- got-archive-all.1 +++ got-archive-all.1 @@ -21,7 +21,7 @@ .Nd run got-archive(1) on all repositories .Sh SYNOPSIS .Nm got-archive-all -.Op Fl sV +.Op Fl fsV .Op Fl o Ar outdir .Op Fl t Ar tmpdir .Ar directory @@ -34,6 +34,8 @@ on all repositories in .Pp The options are as follows: .Bl -tag -width -Ds +.It Fl f +Don't skip already existing tarballs. .It Fl o Ar outdir An existing directory in which the tarball will be created. By default, this will be the current working directory.