diff options
-rw-r--r-- | README.md (renamed from README.markdown) | 4 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rwxr-xr-x | watch-git-tags | 13 |
3 files changed, 14 insertions, 5 deletions
diff --git a/README.markdown b/README.md index 87e8c7c..6ebecd1 100644 --- a/README.markdown +++ b/README.md @@ -26,6 +26,10 @@ you could put this in a `crontab(5)` task to email you new tags: xargs watch-git-tags < ~/.watch-git-tags-repos +Another option is to watch all repositories in a specific directory: + + watch-git-tags "$HOME"/.local/src/watch/* + License ------- @@ -1 +1 @@ -2.0.0 +3.0.0 diff --git a/watch-git-tags b/watch-git-tags index 79e26d8..af60664 100755 --- a/watch-git-tags +++ b/watch-git-tags @@ -3,16 +3,15 @@ self=watch-git-tags # List sorted local tags lt() { - git tag -l | + git tag --list | LC_COLLATE=C sort } # List sorted remote tags rt() { - { git ls-remote -qt || + { git ls-remote --quiet --refs --tags || printf >&2 'Failed to retrieve tags for repository %s\n' "$PWD" - } | awk '!/\^\{\}$/{print substr($2,11)}' | - LC_COLLATE=C sort + } | cut -d/ -f3 | LC_COLLATE=C sort } # Create a temporary directory with name in $td, and handle POSIX-ish traps to @@ -54,6 +53,12 @@ for repo ; do ( # 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 + ) & done # Wait for each of those to finish |