summaryrefslogtreecommitdiff
path: root/commit.h
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2018-05-01 12:47:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-22 03:36:34 (GMT)
commit3afc679b3c13d99e4f02bceb686f11d51576d3ae (patch)
tree74add9b002a7fa5dca0177708b6c8a6dc7b17ad7 /commit.h
parent3258c66332abaf6e3e8fd81cab07ae804760cd08 (diff)
downloadgit-3afc679b3c13d99e4f02bceb686f11d51576d3ae.zip
git-3afc679b3c13d99e4f02bceb686f11d51576d3ae.tar.gz
git-3afc679b3c13d99e4f02bceb686f11d51576d3ae.tar.bz2
commit: use generations in paint_down_to_common()
Define compare_commits_by_gen_then_commit_date(), which uses generation numbers as a primary comparison and commit date to break ties (or as a comparison when both commits do not have computed generation numbers). Since the commit-graph file is closed under reachability, we know that all commits in the file have generation at most GENERATION_NUMBER_MAX which is less than GENERATION_NUMBER_INFINITY. This change does not affect the number of commits that are walked during the execution of paint_down_to_common(), only the order that those commits are inspected. In the case that commit dates violate topological order (i.e. a parent is "newer" than a child), the previous code could walk a commit twice: if a commit is reached with the PARENT1 bit, but later is re-visited with the PARENT2 bit, then that PARENT2 bit must be propagated to its parents. Using generation numbers avoids this extra effort, even if it is somewhat rare. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.h')
-rw-r--r--commit.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/commit.h b/commit.h
index aac3b8c..64436ff 100644
--- a/commit.h
+++ b/commit.h
@@ -341,6 +341,7 @@ extern int remove_signature(struct strbuf *buf);
extern int check_commit_signature(const struct commit *commit, struct signature_check *sigc);
int compare_commits_by_commit_date(const void *a_, const void *b_, void *unused);
+int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_, void *unused);
LAST_ARG_MUST_BE_NULL
extern int run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...);