This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content

Remove hard-coded references to master branch

Daniel Rainer requested to merge use_indexed_commit_instead_of_branch into development

These changes should make gitsearch consistent with the data in the index regarding the versions of the files which are accessed. Instead of using the latest commit on the master branch, files from the indexed commit are accessed, which might be on a different branch (main).

The testing I could do locally is fairly limited, as GitLab won't return any files requested via the api.

Regarding the README files, the approach taken here is to access the version present in the commit which was indexed. This has the advantage that it should be consistent with the metadata. However, when the readme is updated but the metadata file is not, the link from the sharing platform will still be to the old version of the readme.

To prevent this from happening, we could do one of two things:

  1. Update the index when the readme is changed (which requires the metadata to still be correct, otherwise indexing fails).
  2. Do not access the version which was present at the time of indexing and search for the current version instead. This would require making gitsearch aware of the branch preference rules. In addition, it could mean that the indexed metadata and the readme are out of sync.

I favor the first option. What do you think?

Edited by Daniel Rainer

Merge request reports