From a16c3eb057b307629e7969b9ce895bb0bed1de29 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sun, 31 May 2020 02:01:31 -0400 Subject: git-ll-remote: show more info when -a is given --- dot/local/bin/git-ll-remote | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'dot') diff --git a/dot/local/bin/git-ll-remote b/dot/local/bin/git-ll-remote index aee13db..17a50d4 100755 --- a/dot/local/bin/git-ll-remote +++ b/dot/local/bin/git-ll-remote @@ -106,7 +106,7 @@ show_message() git_fetch() { local hash="$1" ref="$2" - have_ref "$hash" || git fetch "$remote" "$ref" + have_ref "$hash" || git fetch --depth=1 "$remote" "$ref" } is_same_ref() @@ -122,11 +122,23 @@ is_ancestor() fi } +verdict() +{ + if is_same_ref HEAD "$1" + then echo even + elif is_ancestor "$1" HEAD + then echo behind + elif is_ancestor HEAD "$1" + then echo ahead + else echo diverged + fi +} + show_this_remote_branch() { local hash="$1" case "$SHOW" in - all) true ;; + all) VERDICT=$(verdict "$hash") ;; behind) is_ancestor "$hash" HEAD ;; ahead) is_ancestor HEAD "$hash" ;; upto) is_same_ref HEAD "$hash" ;; @@ -145,7 +157,13 @@ handle_hash_ref() show_message fi - >&2 printf 'remote: %s\n' "$ref" + if [ "$OPT_a" ] + then + >&2 printf 'remote: %s (%s)\n' "$ref" "$VERDICT" + else + >&2 printf 'remote: %s\n' "$ref" + fi + git show "$hash" | sed '/^$/q' listed=$((listed + 1)) else @@ -156,9 +174,8 @@ handle_hash_ref() read_hashes() { while read hash ref; do - case $ref in - refs/namespaces/*) handle_hash_ref "$hash" "$ref" ;; - esac + [ "$hash" != From ] || continue + handle_hash_ref "$hash" "$ref" done } -- cgit v1.2.3