dotfiles

:)
git clone https://git.sr.ht/~ashymad/dotfiles
Log | Files | Refs | Submodules | LICENSE

commit 2b9fc6d5d95279507ee1764832814963f1c4bf63
parent 4e053f15815a53b5cd21a1d2d5854316de66e946
Author: Szymon Mikulicz <szymon.mikulicz@posteo.net>
Date:   Tue, 22 Sep 2026 11:26:53 +0200

Make src-git cleaner

Diffstat:
Mscripts/.local/bin/src-git | 24++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/scripts/.local/bin/src-git b/scripts/.local/bin/src-git @@ -1,17 +1,14 @@ #!/bin/sh +disp() { + xargs -d '\n' -i printf "\x1b[2K%-25s %.60s\r" "$1" '{}' +} + for dir in ~/.usr/src/*; do [ -d "$dir"/.git ] || continue - tag="$(git -C "$dir" tag --sort=creatordate --points-at HEAD | tail -1)" - if [ -n "$tag" ]; then - [ "$1" = "-u" ] && git -C "$dir" fetch --tags - remote_tag="$(git -C "$dir" for-each-ref --sort=creatordate --format '%(refname)' refs/tags | cut -d/ -f3 | tail -1)" - if [ "${tag#v}" != "${remote_tag#v}" ]; then - printf "%-25s %15s -> %s\n" "$(basename $dir)" "$tag" "$remote_tag" - fi - else - [ "$1" = "-u" ] && git -C "$dir" remote update + if git -C "$dir" symbolic-ref -q HEAD >/dev/null; then + [ "$1" = "-u" ] && git -C "$dir" remote update -v 2>&1 | disp "$(basename $dir)" branch="$(git -C "$dir" rev-parse --abbrev-ref HEAD)" if [ "$branch" = "HEAD" ]; then echo "No branch or tag found for $pkg" @@ -20,8 +17,15 @@ for dir in ~/.usr/src/*; do if remote="$(git -C "$dir" rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null)"; then commits="$(git -C "$dir" rev-list --left-only --count "$remote...@")" if [ "$commits" != 0 ]; then - printf "%-25s %15s ++ %s\n" "$(basename $dir)" "$branch" "$commits" + /usr/bin/printf "\x1b[2K%-25s %15s ++ %s\n" "$(basename $dir)" "$branch" "$commits" fi fi + else + tag="$(git -C "$dir" describe --exact-match --tags)" + [ "$1" = "-u" ] && git -C "$dir" fetch -v --tags 2>&1 | disp "$(basename $dir)" + remote_tag="$(git -C "$dir" for-each-ref --sort=creatordate --format '%(refname)' refs/tags | cut -d/ -f3 | tail -1)" + if [ "${tag#v}" != "${remote_tag#v}" ]; then + /usr/bin/printf "\x1b[2K%-25s %15s -> %s\n" "$(basename $dir)" "$tag" "$remote_tag" + fi fi done