summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2020-05-30 20:34:50 -0400
committerAndrew Cady <d@jerkface.net>2020-05-30 20:34:50 -0400
commitde5aaa74d6cc7c18f87f563fa822be4adf4529c4 (patch)
treebb4637f6e403c2db1f223e6ff731a247aad12efe
parentfc49cb44ae436bd2988ed0ae507ea0bec251548f (diff)
git-ll-remote: improved reporting; fixes
-rwxr-xr-xdot/local/bin/git-ll-remote42
1 files changed, 23 insertions, 19 deletions
diff --git a/dot/local/bin/git-ll-remote b/dot/local/bin/git-ll-remote
index a0e689b..88211c4 100755
--- a/dot/local/bin/git-ll-remote
+++ b/dot/local/bin/git-ll-remote
@@ -48,33 +48,37 @@ show_reverse_message()
48 '' 48 ''
49} 49}
50 50
51show_message()
52{
53 if [ "$OPT_a" ]
54 then show_all_message
55 elif [ "$OPT_r" ]
56 then show_reverse_message
57 else show_normal_message
58 fi
59}
60
61git_fetch()
62{
63 local hash="$1" ref="$2"
64 have_ref "$hash" || git fetch "$remote" "$ref"
65}
66
51handle_hash_ref() 67handle_hash_ref()
52{ 68{
53 local hash="$1" ref="$2" 69 local hash="$1" ref="$2"
54 if ! have_ref $hash 70 git_fetch "$hash" "$ref" || exit
55 then 71
56 git fetch $remote $ref; 72 [ "$OPT_r" ] && set -- "$hash" HEAD || set -- HEAD "$hash"
57 fi 73 if [ "$OPT_a" ] || git merge-base --is-ancestor "$1" "$2"
58 if [ -z "$OPT_r" ]
59 then
60 cmd="git merge-base --is-ancestor HEAD $hash"
61 else
62 cmd="git merge-base --is-ancestor $hash HEAD"
63 fi
64 if [ "$OPT_a" ] || $cmd
65 then 74 then
66 if ! [ "$OPT_q" ] 75 if [ ! "$OPT_q" -a "$listed" -eq 0 ]
67 then 76 then
68 if [ "$OPT_a" ] 77 show_message
69 then show_all_message
70 elif [ "$OPT_r" -a "$listed" -eq 0 ]
71 then show_reverse_message
72 else show_normal_message
73 fi
74 fi 78 fi
75 79
76 >&2 printf 'remote: %s\n' "$ref" 80 >&2 printf 'remote: %s\n' "$ref"
77 git show $hash | sed '/^$/q' 81 git show "$hash" | sed '/^$/q'
78 listed=$((listed + 1)) 82 listed=$((listed + 1))
79 else 83 else
80 skipped=$((skipped + 1)) 84 skipped=$((skipped + 1))