Add CITATION.cff detection and repository overview support

What does this MR do and why?

Adds minimal CITATION.cff support for software repositories (iteration 1).

  • Detects CITATION.cff as a special file type via Gitlab::FileDetector.
  • Exposes it through Repository#citation_blob with caching and cache invalidation.
  • Renders it with a new BlobViewer::Citation auxiliary viewer and header partial.
  • Surfaces view/add actions on the project overview via ProjectPresenter#citation_anchor_data.

Parsing citation metadata into APA/BibTeX strings remains a follow-up and will need the CFF gem plus docs.

References

Screenshots or screen recordings

The UI change is covered by a feature spec (spec/features/projects/show/user_sees_citation_button_spec.rb) that runs as a system test against the rendered pages, so both changes are asserted end-to-end.

Before After
No CITATION.cff button in the Project information panel CITATION.cff button linking to the file, or Add CITATION.cff when the file is missing
Blob page shows only the raw file contents Blob page shows a citation header with a "Learn more about CITATION.cff files." link above the file

The actual screenshots are queued behind my fork's CI minutes quota and will be attached here as soon as they are generated.

How to set up and validate locally

  1. Add a CITATION.cff file to a test project on default branch.
  2. Visit project overview, confirm CITATION.cff button links to the blob page.
  3. Visit the CITATION.cff blob page, confirm auxiliary header renders with Learn more link.
  4. Remove the file as a user with push access, confirm Add CITATION.cff button appears.
  5. Run focused specs:
    • bin/rspec spec/lib/gitlab/file_detector_spec.rb
    • bin/rspec spec/models/blob_viewer/citation_spec.rb
    • bin/rspec spec/models/repository_spec.rb -e '#citation_blob'
    • bin/rspec spec/presenters/project_presenter_spec.rb -e '#citation_anchor_data'

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

  • Changelog trailer (Changelog: added) on first commit
  • Tests added for file detection, repository cache, viewer, presenter
  • Documentation update (follow-up with APA/BibTeX rendering)
  • Screenshots attached (pending CI quota)
  • tooling/bin/gettext_extractor locale/gitlab.pot (verified by static-analysis 2/2 job, which runs gettext:updated_check)
Edited by rajasekhar

Merge request reports

Loading
Loading