tag: factor out contains traversal

Other "--contains" traversals can benefit from the same
speedups that "tag --contains" has received. This code was
not originally made generically available because it has
some gross corners that make it easy to use it in a wrong or
unsafe way. This patch moves the code to commit.[ch] and
attempts to clean up those corners. Specifically:

  1. The "contains" function is renamed to "commit_contains",
     to more clearly indicate what it does.

  2. The original calling convention was to simply call
     "contains", which would magically cache intermediate
     results in the object flag bits. Now we have a context
     struct and an init/release pair, which makes it more
     clear that calls with the same context are related.

  3. From a modularity standpoint, the traversal would
     ideally operate purely on the commit_contains_context.
     But like most traversals, we keep our state in the
     global commit object flags, which means we can only run
     one "contains" traversal at a time.  Therefore, the
     init function will notice and abort when a second
     simultaneous traversal is begun.

  4. The cached state reflects the results for a particular
     set of "want" commits. With the original interface,
     there was nothing to prevent calling "contains" with a
     new set of "want" commits, which would produce
     incoherent results. Now, the contained commits are
     provided once by the init function (which, as noted
     above, will die if invoked twice without an intervening
     finish).

  5. The original implementation abused UNINTERESTING and
     TMP_MARK. Instead, we define new flags to avoid
     conflict with existing revision flags.

  6. The original implementation just left the global object
     flags smudged. This is OK for "tag --contains", but not
     for general use. The release function now clears our
     object flags after use.
move parse_opt_points_at
add ref-filter api
tag: convert to ref-filter
branch: bump up get_head_description
branch: move symref prefix-stripping to presentation layer
branch: roll show_detached HEAD into regular ref_list
branch: drop non-commit error reporting
branch: push 'current' check down to presentation layer
branch: fix width computation
branch: drop unused items from ref_list
ref-filter: implement --merged
ref-filter: local/remote type matching
ref-filter: optionally resolve symrefs
ref-filter: add "with" alias to OPT_CONTAINS
branch: convert to ref-filter
ref-filter: learn about path-matching

ugh, multiple non-matching implementations are ugly, but we
must do it this way to keep tag and for-each-ref
compatibility.

We should add tests for both cases.
ref-filter: add util field
for-each-ref: update refinfo field names

To match upcoming ref-filter.
for-each-ref: convert to ref-filter