diff options
author | Jacob Keller <jacob.keller@gmail.com> | 2022-03-11 16:00:15 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-13 18:39:29 +0000 |
commit | 2e8ea40fe3b9befc1420aed6defe8b48f302ca7b (patch) | |
tree | 2de8c91b788a26ea419d5676a1e3b73c93d47295 /t/t4034/fortran/post | |
parent | The eighth batch (diff) | |
download | tgif-2e8ea40fe3b9befc1420aed6defe8b48f302ca7b.tar.xz |
name-rev: use generation numbers if available
If a commit in a sequence of linear history has a non-monotonically
increasing commit timestamp, git name-rev might not properly name the
commit.
This occurs because name-rev uses a heuristic of the commit date to
avoid searching down tags which lead to commits that are older than the
named commit. This is intended to avoid work on larger repositories.
This heuristic impacts git name-rev, and by extension git describe
--contains which is built on top of name-rev.
Further more, if --all or --annotate-stdin is used, the heuristic is not
enabled because the full history has to be analyzed anyways. This
results in some confusion if a user sees that --annotate-stdin works but
a normal name-rev does not.
If the repository has a commit graph, we can use the generation numbers
instead of using the commit dates. This is essentially the same check
except that generation numbers make it exact, where the commit date
heuristic could be incorrect due to clock errors.
Since we're extending the notion of cutoff to more than one variable,
create a series of functions for setting and checking the cutoff. This
avoids duplication and moves access of the global cutoff and
generation_cutoff to as few functions as possible.
Add several test cases including a test that covers the new commitGraph
behavior, as well as tests for --all and --annotate-stdin with and
without commitGraphs.
Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4034/fortran/post')
0 files changed, 0 insertions, 0 deletions