aboutsummaryrefslogtreecommitdiff
path: root/watch-git-tags
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-11-30 14:43:05 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-11-30 14:43:05 +1300
commit992ac9a112411c38fd6b63ac30f06f2047977bcc (patch)
treee697b44c1ac459453749cfad5d883ca4c92f5c76 /watch-git-tags
parentMerge branch 'release/v3.0.0' into develop (diff)
downloadwatch-vcs-tags-992ac9a112411c38fd6b63ac30f06f2047977bcc.tar.gz
watch-vcs-tags-992ac9a112411c38fd6b63ac30f06f2047977bcc.zip
Rename and refactor local functions
Diffstat (limited to 'watch-git-tags')
-rwxr-xr-xwatch-git-tags28
1 files 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