tg-info.sh: make --heads work as intended
commitcb31e4fde89c3958ef4506215328598439d5feef
authorKyle J. McKay <mackyle@gmail.com>
Mon, 13 Mar 2017 06:35:16 +0000 (12 23:35 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Mon, 13 Mar 2017 06:35:16 +0000 (12 23:35 -0700)
tree553428e4e548f0d8f08f8d9f31b060493f9ecc99
parent3700341ee453526fc915a267ade60de06b370de4
tg-info.sh: make --heads work as intended

The intent of the `tg info --heads [<committish>]` command is
to show which TopGit head branch(es), if any, logically
contain the specified committish (which defaults to HEAD).

The correct answer(s) should be given regardless of whether
or not any of the TopGit branches are actually out-of-date at
the moment with respect to any of their direct or indirect
dependencies.

If a TopGit repository contains more than one patch series
(i.e. `tg summary --heads` shows more than one result), it
could be they share some of the same TopGit dependencies.

To find out if a particular TopGit branch is used by more than
one of the TopGit heads it can simply be passed to the
`tg info --heads` command as the single argument.  This works
even if the branch in question is currently being worked on
and its tip commit has not yet been merged into any of its
dependents yet.

This information can be very useful and was the intended
functionality of the `tg info --heads` option from the start.

Now it works as intended.  Unfortunately the computation is
not that cheap but most of the time in a complex repository
is spent running (just once) the `git branch --contains` command
(provided the TopGit cache is already current) so there's
really no help for that.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
README
tg-info.sh