]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit-reach: move compare_commits_by_gen
authorDerrick Stolee <dstolee@microsoft.com>
Fri, 19 Feb 2021 12:34:08 +0000 (12:34 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Feb 2021 21:34:34 +0000 (13:34 -0800)
Move this earlier in the file so it can be used by more methods.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-reach.c

index 7a3a1eb1a26eda2172515cee1fdbe6d101d4c551..a34c5ba09e81fef09fe302b598cf3de777c155d3 100644 (file)
 
 static const unsigned all_flags = (PARENT1 | PARENT2 | STALE | RESULT);
 
+static int compare_commits_by_gen(const void *_a, const void *_b)
+{
+       const struct commit *a = *(const struct commit * const *)_a;
+       const struct commit *b = *(const struct commit * const *)_b;
+
+       timestamp_t generation_a = commit_graph_generation(a);
+       timestamp_t generation_b = commit_graph_generation(b);
+
+       if (generation_a < generation_b)
+               return -1;
+       if (generation_a > generation_b)
+               return 1;
+       return 0;
+}
+
 static int queue_has_nonstale(struct prio_queue *queue)
 {
        int i;
@@ -647,21 +662,6 @@ int commit_contains(struct ref_filter *filter, struct commit *commit,
        return repo_is_descendant_of(the_repository, commit, list);
 }
 
-static int compare_commits_by_gen(const void *_a, const void *_b)
-{
-       const struct commit *a = *(const struct commit * const *)_a;
-       const struct commit *b = *(const struct commit * const *)_b;
-
-       timestamp_t generation_a = commit_graph_generation(a);
-       timestamp_t generation_b = commit_graph_generation(b);
-
-       if (generation_a < generation_b)
-               return -1;
-       if (generation_a > generation_b)
-               return 1;
-       return 0;
-}
-
 int can_all_from_reach_with_flag(struct object_array *from,
                                 unsigned int with_flag,
                                 unsigned int assign_flag,