summaryrefslogtreecommitdiff
path: root/commit-reach.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-02-19 12:34:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-02-22 21:34:34 (GMT)
commitc8d693e1e6d3bd883224559cf4c1b07d9d58e0cf (patch)
treeb4af78377305da34f0aef851f7b2578701577eae /commit-reach.c
parentfbc21e3fbba982c50a3c2a273038770a249ed510 (diff)
downloadgit-c8d693e1e6d3bd883224559cf4c1b07d9d58e0cf.zip
git-c8d693e1e6d3bd883224559cf4c1b07d9d58e0cf.tar.gz
git-c8d693e1e6d3bd883224559cf4c1b07d9d58e0cf.tar.bz2
commit-reach: move compare_commits_by_gen
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>
Diffstat (limited to 'commit-reach.c')
-rw-r--r--commit-reach.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/commit-reach.c b/commit-reach.c
index 7a3a1eb..a34c5ba 100644
--- a/commit-reach.c
+++ b/commit-reach.c
@@ -17,6 +17,21 @@
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,