Merge branch 'ds/ahead-behind'

"git for-each-ref" learns '%(ahead-behind:<base>)' that computes the
distances from a single reference point in the history with bunch
of commits in bulk.

* ds/ahead-behind:
  commit-reach: add tips_reachable_from_bases()
  for-each-ref: add ahead-behind format atom
  commit-reach: implement ahead_behind() logic
  commit-graph: introduce `ensure_generations_valid()`
  commit-graph: return generation from memory
  commit-graph: simplify compute_generation_numbers()
  commit-graph: refactor compute_topological_levels()
  for-each-ref: explicitly test no matches
  for-each-ref: add --stdin option
This commit is contained in:
Junio C Hamano
2023-04-06 13:38:21 -07:00
17 changed files with 866 additions and 91 deletions

View File

@ -9,7 +9,8 @@ SYNOPSIS
--------
[verse]
'git for-each-ref' [--count=<count>] [--shell|--perl|--python|--tcl]
[(--sort=<key>)...] [--format=<format>] [<pattern>...]
[(--sort=<key>)...] [--format=<format>]
[ --stdin | <pattern>... ]
[--points-at=<object>]
[--merged[=<object>]] [--no-merged[=<object>]]
[--contains[=<object>]] [--no-contains[=<object>]]
@ -32,6 +33,10 @@ OPTIONS
literally, in the latter case matching completely or from the
beginning up to a slash.
--stdin::
If `--stdin` is supplied, then the list of patterns is read from
standard input instead of from the argument list.
--count=<count>::
By default the command shows all refs that match
`<pattern>`. This option makes it stop after showing
@ -217,6 +222,11 @@ worktreepath::
out, if it is checked out in any linked worktree. Empty string
otherwise.
ahead-behind:<committish>::
Two integers, separated by a space, demonstrating the number of
commits ahead and behind, respectively, when comparing the output
ref to the `<committish>` specified in the format.
In addition to the above, for commit and tag objects, the header
field names (`tree`, `parent`, `object`, `type`, and `tag`) can
be used to specify the value in the header field.