Skip to content

Fix pagination cursor generation for TreeEntries

Vasilii Iakliushin requested to merge 351443_incorrect_pagination_cursor into master

Contributes to gitlab#351443 (closed)
Contributes to create-stage#12810 (closed)

Problem

We return the same pagination cursor when users fetch repository tree. The pagination cursor is based on blobs ids.

However, empty blobs have the same id (because it's calculated based on the content of the blob).

git ls-tree -r -t HEAD

100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391	funzone/top2_11.md
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391	funzone/top2_12.md

As a result, pagination doesn't work as expected.

Solution

Use a different algorithm to generate the cursor token. Instead of blob id, we can use a hashed representation of the file name. It should be unique in the scope of the directory.

Changelog: changed

Edited by Sean Carroll

Merge request reports