-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Allow any ref of a Git repo in the fragment #11147
base: main
Are you sure you want to change the base?
fix: Allow any ref of a Git repo in the fragment #11147
Conversation
@@ -32,8 +32,7 @@ module Remote = struct | |||
type nonrec t = | |||
{ url : string | |||
; default_branch : Object.resolved option Fiber.t | |||
; branches : Object.resolved String.Map.t Fiber.t | |||
; tags : Object.resolved String.Map.t Fiber.t | |||
; refs : Object.resolved String.Map.t Fiber.t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tbh, this doesn't seem like an improvement in readability. I think you could just as easily just parse the refs/{heads,tags}
out of the query and then know which map you need to look in.
Opinions aside, I think this makes it a bit harder to implement the "did you mean" hint. That one would be rather useful when a user typos a branch or a tag. IMO you should hold off this refactoring until we have that useful hint ready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is with other types of refs like pull
refs for heads and merges. The dune repo itself has at least 4 types of refs and we don't even do anything particularly unusual with Git.
Git refs are basically just a Object.resolved String.Map.t
and the string is just refs/{heads,tags}
by convention, so to me this seems like the best way to represent them aligned with how Git treats them, thus fewer concepts to keep in mind and less ways for repos to break our assumptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving as this PR fixes the issue reliably like it advertises. Not a fan of keeping map where everything is prefixed with refs/{heads,tags} - I would prefer the types to reflect the structure, and help improve the hints.
I understand, however the way it works in opam is that every ref in We could of course also say that we only support branch and tag references because it's unlikely someone would use them, however that feels like an easy feature to support at the cost of a slightly messy map. |
This reverses the split of branches and tags from ocaml#11127, instead putting all possible references (e.g. also pull requests) in the same map and implements short-hands for looking up unqualified refs. Fixes ocaml#11140 Signed-off-by: Marek Kubica <[email protected]>
ec51e96
to
557841c
Compare
This reverses the split of branches and tags from #11127, instead putting all possible references (e.g. also pull requests) in the same map and implements short-hands for looking up unqualified refs.
Fixes #11140