3

I want to load the file contents from the gitlab api using a specific tag.

This can be achieved by using the blob for each file (https://docs.gitlab.com/ee/api/repository_files.html).

The problem I am facing is that I do not see the way to find out what file paths are available for a given commit (a tag in my case).

I am looking for something similar to github's tree object.

How do I get all the files and their respective paths with a given commit hash from the gitlab api to load their contents?

Thanks :)

Markus
  • 2,214
  • 3
  • 19
  • 32

2 Answers2

0

You can get a list of repository files and directories in a project by calling this API:

GET /projects/:id/repository/tree

See here for more information such as optional parameters.

Mostafa Fakhraei
  • 3,409
  • 3
  • 11
  • 25
0

Did you try GetDiff?

https://docs.gitlab.com/ee/api/commits.html#get-the-diff-of-a-commit

A bit slow, hence if brings the diff text itself as well, but it works.

Arpicheck
  • 1
  • 1