Track preferred commit-ish to account for synthetic git repos
Created by: varungandhi-src
Partial progress towards #31937. This only includes backend changes.
Notes for reviewers
- The first commit is from https://github.com/sourcegraph/sourcegraph/pull/32625.
- Commits are mostly cleaned up for easier reviewing; most commits are no-ops. I will add further changes as fixups or new commits once review starts.
- The key change is that we have a new
preferredCanonicalCommitish
field in the GraphQL schema. In the future, we can prefer tags over versions in frontend code by requesting this field and using it to create any necessary canonical URLs (instead of directly using the oid). The commit-ish [definition] terminology is taken from git itself. It's more precise than "revision". - Frontend changes will be in subsequent PRs. For example, some of the changes need to go in the code-intel-extension repo, not this repo.
Test plan
I've added some unit tests for tags + canonical URLs. Specific suggestions for other tests that would be useful to add are welcome.