From ba09bce2618e03c39aa41658c108259f9f49395a Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Mon, 23 Nov 2015 22:11:18 -0800 Subject: [PATCH] tg-info.sh: report correct commit count when base is out-of-date Use the new multi-head functionality of measure_branch to properly show a head that is out-of-date with respect to its base. Signed-off-by: Kyle J. McKay --- tg-info.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tg-info.sh b/tg-info.sh index c9369b8..38e18ab 100644 --- a/tg-info.sh +++ b/tg-info.sh @@ -100,13 +100,28 @@ sed '/^!/d' <"$depcheck" >"$depcheck2" if [ -s "$depcheck2" ]; then echo "Needs update from:" # 's/ [^ ]* *$//' -- last is $name - # 's/^[:] //' -- don't distinguish base updates - <"$depcheck2" sed -e 's/ [^ ]* *$//' -e 's/^[:] //' | + # 's/^[:] /:/' -- don't distinguish base updates + <"$depcheck2" sed -e 's/ [^ ]* *$//' -e 's/^[:] /:/' | while read dep chain; do + case "$dep" in + :*) + dep="${dep#:}" + fulldep="refs/heads/$dep" + extradep="refs/top-bases/$dep" + ;; + *) + extradep= + case "$dep" in + refs/*) + fulldep="$dep";; + *) + fulldep="refs/heads/$dep";; + esac + ;; + esac printf '%s' "$dep " [ -n "$chain" ] && printf '%s' "(<= $(echo "$chain" | sed 's/ / <= /')) " - case "$dep" in refs/*) fulldep="$dep";; *) fulldep="refs/heads/$dep"; esac - printf '%s' "($(measure_branch "$fulldep" "refs/heads/$name"))" + printf '%s' "($(measure_branch "$fulldep" "refs/heads/$name" $extradep))" echo done | sed 's/^/ /' else -- 2.11.4.GIT