mv func to lib
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
diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
index e9bf111..dc7a1df 100644
--- a/gotweb/gotweb.c
+++ b/gotweb/gotweb.c
@@ -181,10 +181,6 @@ 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 *);
-
-/* got_repo_resolve_commit_arg */
-static const struct got_error* resolve_commit_arg(struct got_object_id **,
- const char *, struct got_repository *);
static const struct got_error* match_object_id(struct got_object_id **,
char **, const char *r, int, int,
struct got_repository *);
@@ -319,39 +315,6 @@ done:
}
static const struct got_error *
-resolve_commit_arg(struct got_object_id **commit_id,
- const char *commit_id_arg, struct got_repository *repo)
-{
- const struct got_error *err;
- struct got_reference *ref;
- struct got_tag_object *tag;
-
- err = got_repo_object_match_tag(&tag, commit_id_arg,
- GOT_OBJ_TYPE_COMMIT, repo);
- if (err == NULL) {
- *commit_id = got_object_id_dup(
- got_object_tag_get_object_id(tag));
- if (*commit_id == NULL)
- err = got_error_from_errno("got_object_id_dup");
- got_object_tag_close(tag);
- return err;
- } else if (err->code != GOT_ERR_NO_OBJ)
- return err;
-
- err = got_ref_open(&ref, repo, commit_id_arg, 0);
- if (err == NULL) {
- err = got_ref_resolve(commit_id, repo, ref);
- got_ref_close(ref);
- } else {
- if (err->code != GOT_ERR_NOT_REF)
- return err;
- err = got_repo_match_object_id_prefix(commit_id,
- commit_id_arg, GOT_OBJ_TYPE_COMMIT, repo);
- }
- return err;
-}
-
-static const struct got_error *
match_object_id(struct got_object_id **id, char **label,
const char *id_str, int obj_type, int resolve_tags,
struct got_repository *repo)
@@ -2428,7 +2391,7 @@ gw_get_file_blame(struct gw_trans *gw_trans, char *commit_str)
if (error)
goto done;
- error = resolve_commit_arg(&commit_id, commit_str, repo);
+ error = got_repo_resolve_commit_arg(&commit_id, commit_str, repo);
if (error)
goto done;
@@ -2565,7 +2528,8 @@ gw_get_repo_tree(struct gw_trans *gw_trans, char *commit_str)
got_ref_close(head_ref);
} else
- error = resolve_commit_arg(&commit_id, commit_str, repo);
+ error = got_repo_resolve_commit_arg(&commit_id, commit_str,
+ repo);
if (error)
goto done;