go-bitbucket
go-bitbucket copied to clipboard
Combine Brach and Tag Options
Currently Branches and Tags have separate Options structs although they are essentially the same endpoint. RepoBranchesOptions is only different from RepoTagsOptions in that it possess a BranchName
field as shown here
https://github.com/ktrysmt/go-bitbucket/blob/dd207502d8275183cfd0d771d074c771af9ae1ce/bitbucket.go#L202-L211
and
https://github.com/ktrysmt/go-bitbucket/blob/dd207502d8275183cfd0d771d074c771af9ae1ce/bitbucket.go#L224-L232
I propose that we combine the repo branches and tag option structs into a single RepositoryRefOptions
(branches and tags are both refs anyways) and instead of a BranchName
field just have a Name
field that represents either the branch name or tag name. This would allow us to have a single ListRefs
function instead of two separate functions for listing branches and listing tags. That way users can use the same options struct to access a single function for listing refs (i.e. branches or tags) and it can make use of the existing GetBranch function to also get a tag.
So, @ktrysmt If this proposal is acceptable and you agree, can you assign me to do this refactor please. For context, I've already started working on this for fun in my fork.
Thanks in advance.
Best, dd
For references we could possible include another field inside the Options struct that is a boolean for determining whether or not the refoptions
describes a branch or tag so that it handles easily the funcs for the GetBranch or GetTag (GetTag to be added as part of the PR to resolve this issue if you approve @ktrysmt )
Exactly. These options are duplicated likely. It seems a good idea. @DataDavD
Ok great I'll start on it.
Can you please assign me to this issue