daygloink
daygloink

Reputation: 437

Gitlab API get repository tree recursively

How do I get a repository tree recursively using the Gitlab API?

I am currently using this method: GET /projects/:id/repository/tree?ref_name=:ref_name

This works, however it is not recursive and is only showing the files in the root directory.

I need to get a complete file list of ALL files in the repository, not just the ones in the root directory.

Any help would be greatly appreciated.

Upvotes: 1

Views: 3506

Answers (2)

Mike Nishizawa
Mike Nishizawa

Reputation: 2022

Not sure if this is still an issue for you but if you add another url parameter, so it would read: GET /projects/:id/repository/tree?ref_name=:ref_name&recursive=true

Alternatively, if you are looking relative to a certain path, you could specify a path instead of a ref_name and it will be a little more friendly. GET /projects/:id/repository/tree?path=my/path?recursive=true

Upvotes: 4

ootwch
ootwch

Reputation: 960

The API does not have this feature at the current time, however it is currently discussed (December 2015).

Check https://gitlab.com/gitlab-org/gitlab-ce/issues/4205 for discussion

Feature request: https://gitlab.com/gitlab-org/gitlab-ce/issues/4270

Upvotes: 2

Related Questions