-
-
Notifications
You must be signed in to change notification settings - Fork 163
"glab mr for" returns 400 - ref is empty #736
Comments
i have the same problem. |
Hi @Ekik and @idcmardelplata, I can't seem to reproduce this issue. I may need a little bit of information to be able to resolve this. Are you using a self hosted GitLab instance? If yes, what version? |
@profclems I too am using gitlab.com, so no difference there. One thing I'm doing a bit differently than some others is that I use Gitlab Groups to Organize my projects. This means my Git URLs look like this: It might be a bit far fetched, but I'm mentioning it anyways since I actually had issues with other projects / products before that didn't account for the usage of groups. |
I can't reproduce this too. Tried this with self-hosted and gitlab.com, for personal and group projects and it worked every time. Are you still having this issue? Maybe there was an issue with the API itself (which also is far fetched, but since 2 people can't reproduce it 🤷♂️) |
I'm still able to reproduce it, and here's some more info I managed to dig up. Based on the fact that glab is POSTing to that particular URL leads me to believe it's trying to create a new branch for me. # This does not work and gives a 404 because the "/" in the project ID isn't correctly URL encoded.
# I don't think this is what happens with glab, because there we're seeing a 400 BAD REQUEST.
curl --header "Authorization: Bearer SECRET" -X POST "https://gitlab.com/api/v4/projects/virtual-tourist/vt-guide/repository/branches?branch=newbranch&ref=master"
# Using any of these requests works fine.
# In the first case I've properly url-encoded the project ID, and in the second case I'm using the numeric one.
curl --header "Authorization: Bearer SECRET" -X POST "https://gitlab.com/api/v4/projects/virtual-tourist%2Fvt-guide/repository/branches?branch=newbranch&ref=master"
curl --header "Authorization: Bearer SECRET" -X POST "https://gitlab.com/api/v4/projects/17291191/repository/branches?branch=newbranch&ref=master"
# This does NOT work because I've removed the "&ref=master" from the end of the URL.
# This results in a response of `{"error":"ref is missing, ref is empty"}`, which is exactly the response I'm getting with glab as well.
curl --header "Authorization: Bearer SECRET" -X POST "https://gitlab.com/api/v4/projects/17291191/repository/branches?branch=newbranch" Could it be the case that glab for some reason is failing to append |
This issue has been automatically marked as stale because it has not had recent activity. We haven't had the time to address it yet, but we want to keep it open. This message is just a reminder for us to help triage issues. |
@Ekik @idcmardelplata do you still have this issue with the current GitLab version? |
@profclems I'm afraid so. |
This issue has been automatically marked as stale because it has not had recent activity. We haven't had the time to address it yet, but we want to keep it open. This message is just a reminder for us to help triage issues. |
Description
The
glab mr for <issue_id>
command always returns a "ref is empty" for me. All other commands seem to work well as far as I can see.Expected Behavior vs Actual Behavior
When issuing
glab mr for <issue_id>
I always get the following error message back:"POST https://gitlab.com/api/v4/projects/repo/repository/branches: 400 {error: ref is empty}"
I would expect a merge request to be created.
Steps to Reproduce
So my first attempt started out like this, simply trying to create an MR for an issue.
I can kinda see why that doesn't work, because I haven't created a branch yet. However it would be great to have better docs and error messaging here, or the ability to have glab create the branch for me. That's would closely mirror the behavior of the web UI.
However, I gave it a go and added the branch...
I was surprised by the fact that I still got the same error even though the branch now exists.
It's very likely that I'm just using it wrong, but I thought I'd post the issue just in case it's really a bug, or in case some one else does the same usage mistake as I did.
Your Environment
glab version 1.17.0 (2021-05-14)
OS: Manjaro 21.0.4
The text was updated successfully, but these errors were encountered: