Skip to content

Importing a local repo using the API doesn't seem to work properly. #9156

Closed
@guillep2k

Description

@guillep2k

Gitea: 1.10.0 (release)

Importing a local repository from the API seems to miss certain steps. When I do:

curl -X POST https://git.xxx.com.ar/api/v1/repos/migrate -H 'accept: application/json' \
    -H 'Authorization: token xxxxxxxx' -H 'Content-Type: application/json' \
    -d '{ "clone_addr": "/home/xxxxx/convert/projectxxxx", "description": "Project XXX",
          "mirror": false, "private": true, "repo_name": "projectxxx", "uid": 9}' -i

The call succeeds and I get the expected JSON response (new repo ID: 103), but when I use the UI to see the repository I get a 500 Server Error. The log shows:

2019/11/25 11:21:23 routers/repo/view.go:376:Home() [E] models.GetMigratingTask: task is not exist [id: 0, repo_id: 103, type: 0]

The record in the database was created and the directory for the repo was created too (sorry, I couldn't check any further because this was my prod site and I was in a hurry). The row in the database was:

gitea=# select * from repository where id = 103;
 id  | owner_id |   lower_name   |      name      |   description    | website | default_branch | num_watches | num_stars | num_forks | num_issues | num_closed_issues | num_pulls | num_closed_pulls | num_milestones | num_closed_milestones | is_private | is_empty | is_archived | is_mirror | is_fork | fork_id |  size   | is_fsck_enabled | close_issues_via_commit_in_any_branch | topics | created_unix | updated_unix | avatar | original_url | status | original_service_type
-----+----------+----------------+----------------+------------------+---------+----------------+-------------+-----------+-----------+------------+-------------------+-----------+------------------+----------------+-----------------------+------------+----------+-------------+-----------+---------+---------+---------+-----------------+---------------------------------------+--------+--------------+--------------+--------+--------------+--------+-----------------------
 103 |        9 | xxxxxxxxxxxxxx | xxxxxxxxxxxxxx | XXXXXXXXXXXXXXXX |         | master         |           1 |         0 |         0 |          0 |                 0 |         0 |                0 |              0 |                     0 | t          | f        | f           | f         | f       | 0       | 4741120 | t               | f                                     | null   |   1574691626 |   1574691627 |        |              |      1 |            0
(1 row)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions