diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-01-29 15:27:53 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-02-01 11:10:29 +0300 |
commit | 94a29a219b2ff54f4d24d91c8e4a79f9ad9f22ba (patch) | |
tree | e89d3059dd62a8492f99e10b140bdd68c806d78d /proto/ref.proto | |
parent | 5fb7e9c3f947ae02acf1177f46b3b9b6b29fe556 (diff) |
ref: Fix FindRef RPC confusing reference names
The `FindRef()` RPC accepts as parameter an unqualified branch name. We
thus need to convert it to a fully qualified branch name in order to not
cause ambiguous reference lookups in the RPC's implementation.
To convert the branch name, we currently use `NewBranchReferenceName()`,
which has dangerous semantics as it will treat a branch name starting
with "refs/heads/" as an already-qualified branch. As a result, we'd now
start to look up the "master" branch instead of the "refs/heads/master".
Let's fix this bug by converting to `NewReferenceFromBranchName()`. Note
that this changes semantics of the RPC to only support unqualified
branch names. There is no way around breakage though, as otherwise we
wouldn't be able to cope with ambiguous references.
Diffstat (limited to 'proto/ref.proto')
-rw-r--r-- | proto/ref.proto | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/proto/ref.proto b/proto/ref.proto index 1943b83c4..cd43ed5ca 100644 --- a/proto/ref.proto +++ b/proto/ref.proto @@ -63,6 +63,9 @@ service RefService { op: ACCESSOR }; } + + // FindBranch finds a branch by its unqualified name (like "master") and + // returns the commit it currently points to. rpc FindBranch(FindBranchRequest) returns (FindBranchResponse) { option (op_type) = { op: ACCESSOR @@ -264,8 +267,10 @@ message DeleteBranchRequest { message DeleteBranchResponse {} message FindBranchRequest { + // repository is the repository in which the branch should be looked up. Repository repository = 1 [(target_repository)=true]; - // Name can be 'master' but also 'refs/heads/master' + // name is the name of the branch which should be looked up. This must be the + // branch name only, it must not have the "refs/heads/" prefix. bytes name = 2; } |