move to got_repo_cmp_tags
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
index a883cf2..7c19952 100644
--- a/gotweb/gotweb.c
+++ b/gotweb/gotweb.c
@@ -179,9 +179,6 @@ static void gw_display_index(struct gw_trans *,
static int gw_template(size_t, void *);
static const struct got_error* gw_apply_unveil(const char *, const char *);
-static const struct got_error* cmp_tags(void *, int *,
- struct got_reference *,
- struct got_reference *);
static const struct got_error* gw_blame_cb(void *, int, int,
struct got_object_id *);
static const struct got_error* gw_load_got_paths(struct gw_trans *);
@@ -266,52 +263,6 @@ gw_apply_unveil(const char *repo_path, const char *repo_file)
return NULL;
}
-static const struct got_error *
-cmp_tags(void *arg, int *cmp, struct got_reference *ref1,
- struct got_reference *ref2)
-{
- const struct got_error *err = NULL;
- struct got_repository *repo = arg;
- struct got_object_id *id1, *id2 = NULL;
- struct got_tag_object *tag1 = NULL, *tag2 = NULL;
- time_t time1, time2;
-
- *cmp = 0;
-
- err = got_ref_resolve(&id1, repo, ref1);
- if (err)
- return err;
- err = got_object_open_as_tag(&tag1, repo, id1);
- if (err)
- goto done;
-
- err = got_ref_resolve(&id2, repo, ref2);
- if (err)
- goto done;
- err = got_object_open_as_tag(&tag2, repo, id2);
- if (err)
- goto done;
-
- time1 = got_object_tag_get_tagger_time(tag1);
- time2 = got_object_tag_get_tagger_time(tag2);
-
- /* Put latest tags first. */
- if (time1 < time2)
- *cmp = 1;
- else if (time1 > time2)
- *cmp = -1;
- else
- err = got_ref_cmp_by_name(NULL, cmp, ref2, ref1);
-done:
- free(id1);
- free(id2);
- if (tag1)
- got_object_tag_close(tag1);
- if (tag2)
- got_object_tag_close(tag2);
- return err;
-}
-
int
gw_get_repo_log_count(struct gw_trans *gw_trans, char *start_commit)
{
@@ -2058,7 +2009,7 @@ gw_get_repo_tags(struct gw_trans *gw_trans, int limit, int tag_type)
if (error)
goto done;
- error = got_ref_list(&refs, repo, "refs/tags", cmp_tags, repo);
+ error = got_ref_list(&refs, repo, "refs/tags", got_repo_cmp_tags, repo);
if (error)
goto done;