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 <peff@peff.net> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
f0d9cc4196
commit
5284fc5cc9
9
commit.c
9
commit.c
@ -655,11 +655,10 @@ struct commit *pop_commit(struct commit_list **stack)
|
||||
/* count number of children that have not been emitted */
|
||||
define_commit_slab(indegree_slab, int);
|
||||
|
||||
/* record author-date for each commit object */
|
||||
define_commit_slab(author_date_slab, timestamp_t);
|
||||
|
||||
static void record_author_date(struct author_date_slab *author_date,
|
||||
struct commit *commit)
|
||||
void record_author_date(struct author_date_slab *author_date,
|
||||
struct commit *commit)
|
||||
{
|
||||
const char *buffer = get_commit_buffer(commit, NULL);
|
||||
struct ident_split ident;
|
||||
@ -684,8 +683,8 @@ fail_exit:
|
||||
unuse_commit_buffer(commit, buffer);
|
||||
}
|
||||
|
||||
static int compare_commits_by_author_date(const void *a_, const void *b_,
|
||||
void *cb_data)
|
||||
int compare_commits_by_author_date(const void *a_, const void *b_,
|
||||
void *cb_data)
|
||||
{
|
||||
const struct commit *a = a_, *b = b_;
|
||||
struct author_date_slab *author_date = cb_data;
|
||||
|
Reference in New Issue
Block a user