On Tue, 3 Apr 2018 12:51:41 -0400 Derrick Stolee <dstolee@xxxxxxxxxxxxx> wrote: > +int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_, void *unused) > +{ > + const struct commit *a = a_, *b = b_; > + > + if (a->generation < b->generation) > + return 1; > + else if (a->generation > b->generation) > + return -1; > + > + /* newer commits with larger date first */ > + if (a->date < b->date) > + return 1; > + else if (a->date > b->date) > + return -1; > + return 0; > +} I think it would be clearer if you commented above the first block "newer commits first", then on the second block, "use date as a heuristic to determine newer commit". Other than that, this looks good.