Re: [PATCH 4/6] commit: use generations in paint_down_to_common()
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Apr 3, 2018, 18:31 UTC
- Message-ID
- <20180403113154.4d81719baba74aae53c9a58c@google.com>
- In-Reply-To
- <20180403165143.80661-5-dstolee@microsoft.com>
On Tue, 3 Apr 2018 12:51:41 -0400 Derrick Stolee <dstolee@microsoft.com> wrote:
Show 16 quoted lines
> +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.