]> git.ipfire.org Git - thirdparty/git.git/commit - ref-filter.c
ref-filter: use generation number for --contains
authorDerrick Stolee <dstolee@microsoft.com>
Tue, 1 May 2018 12:47:15 +0000 (12:47 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 22 May 2018 03:36:34 +0000 (12:36 +0900)
commit819807b33f820dc17d96f043747daf18c5e38516
treea631978767968ce79e76f5937e998f1d8a18d03e
parente2838d85b6d35592ff5851d67f0232a78083ada7
ref-filter: use generation number for --contains

A commit A can reach a commit B only if the generation number of A
is strictly larger than the generation number of B. This condition
allows significantly short-circuiting commit-graph walks.

Use generation number for '--contains' type queries.

On a copy of the Linux repository where HEAD is contained in v4.13
but no earlier tag, the command 'git tag --contains HEAD' had the
following peformance improvement:

Before: 0.81s
After:  0.04s
Rel %:  -95%

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref-filter.c