From 992ac9a112411c38fd6b63ac30f06f2047977bcc Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 30 Nov 2018 14:43:05 +1300 Subject: Rename and refactor local functions --- watch-git-tags | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/watch-git-tags b/watch-git-tags index af60664..7ff640a 100755 --- a/watch-git-tags +++ b/watch-git-tags @@ -2,16 +2,22 @@ self=watch-git-tags # List sorted local tags -lt() { - git tag --list | - LC_COLLATE=C sort +local_tags() { + for repo ; do + git -C "$repo" tag --list | LC_COLLATE=C sort + done } # List sorted remote tags -rt() { - { git ls-remote --quiet --refs --tags || - printf >&2 'Failed to retrieve tags for repository %s\n' "$PWD" - } | cut -d/ -f3 | LC_COLLATE=C sort +remote_tags() { + for repo ; do + git -C "$repo" ls-remote --quiet --refs --tags || + printf >&2 'Failed to retrieve tags for repository %s\n' "$PWD" + done | + while read -r _ tag ; do + tag=${tag#refs/tags/} + printf '%s\n' "$tag" + done } # Create a temporary directory with name in $td, and handle POSIX-ish traps to @@ -43,12 +49,8 @@ for repo ; do ( printf '%s\n' "$repo" > path || exit # Write local and remote tags to files - ( - cd -- "$repo" || exit - lt > "$sd"/a || exit - rt > "$sd"/b - ) || - exit + local_tags "$repo" > "$sd"/a || exit + remote_tags "$repo" > "$sd"/b || exit # Write new tags to file LC_COLLATE=C comm -13 -- [ab] > new -- cgit v1.2.3 From adf9e04375d62af9b6b4fee77a6a2654356b0b9a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 30 Nov 2018 14:43:17 +1300 Subject: Use short-circuit logic for pre-fetch test --- watch-git-tags | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/watch-git-tags b/watch-git-tags index 7ff640a..02814cb 100755 --- a/watch-git-tags +++ b/watch-git-tags @@ -57,9 +57,8 @@ for repo ; do ( # Attempt to quietly fetch new tags so that we don't notify about the same # ones next time - if [ -s new ] ; then - git fetch --quiet --tags - fi + [ -s new ] || continue + git -C "$repo" fetch --quiet --tags ) & done -- cgit v1.2.3 From d045518b8b179539b74556154bf302d540027b71 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 30 Nov 2018 14:43:26 +1300 Subject: Correct a comment --- watch-git-tags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/watch-git-tags b/watch-git-tags index 02814cb..e7d2c59 100755 --- a/watch-git-tags +++ b/watch-git-tags @@ -62,7 +62,7 @@ for repo ; do ( ) & done -# Wait for each of those to finish +# Wait for all of those to finish wait # Iterate through the temp dirs in order -- cgit v1.2.3 From e0b901a22ba3fe04c7c0d6c1ceb8eef416702f5a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 30 Nov 2018 14:44:54 +1300 Subject: Bump VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 4a36342..fd2a018 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0 +3.1.0 -- cgit v1.2.3