Duplicate file ids from api repo/tree endpoint

I’m making a call to:

/projects/2/repository/tree?path=helpers&ref=master&recursive=false&per_page=500

where helpers is a directory containing 3 files and another directory. The 3 files are all empty, have a .r extension but different names.

The files id’s are all coming back as e69de29bb2d1d6434b8b29ae775ad8c2e48c5391. If i add some text to one of the files the id changes so i am guessing the hash that makes this id is using the file contents and the extension and not using the name.

Is this a bug? Is there a way round it?

v: gitlab-ce-13.5.4-ce.0.el8.x86_64

have upgraded to 13.6. and the issue is still there

This is effectively how Git’s hashing works internally. The filenames are part of tree objects, but the blob IDs they point to only hash the content for their identifier: https://git-scm.com/book/en/v2/Git-Internals-Git-Objects (short excerpt below, but I recommend a full read)

This is how Git stores the content initially — as a single file
per piece of content, named with the SHA-1 checksum of
the content and its header.
[…]
This object type is called a blob.

GitLab’s repository/tree API endpoint is returning the Git repository identifiers directly.

interesting, thanks for the detail - will have a read