From 65b97752efa3ff21b70f65aaebdde315da3650f4 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 3 Feb 2017 15:27:18 -0800 Subject: [PATCH] tg-summary.sh: skip annihilated branches Skip showing annihilated branches just like the docs claim (and how it used to work). Also restore the semantics of a bare `tg summary` showing all branches that was inadvertently recently broken. The new --with-deps option requires some additional checks to make sure it doesn't resurrect annihilated branches. Signed-off-by: Kyle J. McKay --- tg-summary.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tg-summary.sh b/tg-summary.sh index 2bb1be1..df8138c 100644 --- a/tg-summary.sh +++ b/tg-summary.sh @@ -73,7 +73,7 @@ while [ -n "$1" ]; do esac shift done -defwithdeps=1 +[ $# -eq 0 ] || defwithdeps=1 [ -z "$exclude" ] || exclude="$exclude " if [ "$1" = "--all" ]; then [ -z "$withdeps" ] || die "mutually exclusive options given" @@ -125,12 +125,14 @@ if [ -n "$heads" -a -z "$rdeps" ]; then exit 0 fi +skip_ann= show_dep() { case "$exclude" in *" $_dep "*) return; esac case " $seen_deps " in *" $_dep "*) return 0; esac seen_deps="${seen_deps:+$seen_deps }$_dep" [ -z "$tgish" -o -n "$_dep_is_tgish" ] || return 0 - printf '%s\n' "$_dep" + [ -z "$skip_ann" ] || ! branch_annihilated "$_dep" && printf '%s\n' "$_dep" + return 0 } show_deps() @@ -141,7 +143,8 @@ show_deps() case "$exclude" in *" $_b "*) continue; esac case " $recurse_deps_exclude " in *" $_b "*) continue; esac seen_deps= - _dep="$_b"; _dep_is_tgish=1; show_dep + save_skip="$skip_ann" + _dep="$_b"; _dep_is_tgish=1; skip_ann=; show_dep; skip_ann="$save_skip" recurse_deps show_dep "$_b" recurse_deps_exclude="$recurse_deps_exclude $seen_deps" done @@ -187,7 +190,7 @@ fi if [ -n "$withdeps" ]; then savetgish="$tgish" tgish=1 - branches="$(show_deps | LC_ALL=C sort -u -b -k1,1)" + branches="$(skip_ann=1; show_deps | LC_ALL=C sort -u -b -k1,1)" tgish="$savetgish" fi -- 2.11.4.GIT