Skip to content

Conversation

@sunshowers
Copy link
Collaborator

@sunshowers sunshowers commented Dec 29, 2025

When enabled, older (non-latest) blessed API versions are stored as
.gitref files containing a commit:path reference instead of the full
JSON content. This allows Git to detect new API versions as renames. (The format is designed to be fed into git show).

The git ref uses the first commit that introduced the file (not the current merge-base) to ensure references remain stable as history evolves.

Git ref storage is disabled by default. Enable with
ManagedApis::with_git_ref_storage(), or per-API with
ManagedApi::use_git_ref_storage().

Demo in Omicron:

For more information, see RFD 634.

TODO:

  • add note to the commit message about how this makes git treat the file as a rename
  • handle situation where multiple new versions are added in a single commit
  • allow per-version customization of gitref storage (useful when particular fixed versions are special in some way) will do this when we need it
  • verify that adding a version, then removing it, then adding it again chooses the latest version
  • automated + manual tests around merge conflicts
  • documentation

Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
@david-crespo
Copy link

david-crespo commented Dec 29, 2025

Wow, that is awesome. Didn’t know you can do that. So the gitref effectively takes the old file out of the current list of files, allowing git to treat the change as a move?

Edit: discussed in chat. Answer is yes.

Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
@david-crespo david-crespo mentioned this pull request Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants