commit - 147269d583a21c9ce797d43111f6a162ec07527a
commit + 3468a5fa92072c498186c4e8e12d0742a73442dc
blob - a883cf2287a2ced4b8cb97444a96fb0be058a636
blob + 7c1995239e9ee00725babf091b6df8abc9a5f02d
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
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 *);
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)
{
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;