aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rwxr-xr-xwatch-git-tags35
2 files changed, 19 insertions, 18 deletions
diff --git a/VERSION b/VERSION
index 4a36342..fd2a018 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.0.0
+3.1.0
diff --git a/watch-git-tags b/watch-git-tags
index af60664..e7d2c59 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,25 +49,20 @@ 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
# 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
-# Wait for each of those to finish
+# Wait for all of those to finish
wait
# Iterate through the temp dirs in order