path: root/commit.h
diff options
authorDerrick Stolee <>2018-11-01 13:46:21 (GMT)
committerJunio C Hamano <>2018-11-02 03:14:22 (GMT)
commit5284fc5cc9791b6526b36909373748bc14daef1a (patch)
tree8a9504d5cf8d3734f67d4cda075d19beb16baa71 /commit.h
parentf0d9cc4196a0188724866bc0b11a2e8e0f95ab36 (diff)
commit/revisions: bookkeeping before refactoring
There are a few things that need to move around a little before making a big refactoring in the topo-order logic: 1. We need access to record_author_date() and compare_commits_by_author_date() in revision.c. These are used currently by sort_in_topological_order() in commit.c. 2. Moving these methods to commit.h requires adding an author_date_slab declaration to commit.h. Consumers will need their own implementation. 3. The add_parents_to_list() method in revision.c performs logic around the UNINTERESTING flag and other special cases depending on the struct rev_info. Allow this method to ignore a NULL 'list' parameter, as we will not be populating the list for our walk. Also rename the method to the slightly more generic name process_parents() to make clear that this method does more than add to a list (and no list is required anymore). Helped-by: Jeff King <> Signed-off-by: Derrick Stolee <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'commit.h')
1 files changed, 7 insertions, 0 deletions
diff --git a/commit.h b/commit.h
index 2b1a734..ec5b909 100644
--- a/commit.h
+++ b/commit.h
@@ -8,6 +8,7 @@
#include "gpg-interface.h"
#include "string-list.h"
#include "pretty.h"
+#include "commit-slab.h"
@@ -328,6 +329,12 @@ extern int remove_signature(struct strbuf *buf);
extern int check_commit_signature(const struct commit *commit, struct signature_check *sigc);
+/* record author-date for each commit object */
+struct author_date_slab;
+void record_author_date(struct author_date_slab *author_date,
+ struct commit *commit);
+int compare_commits_by_author_date(const void *a_, const void *b_, void *unused);
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);