Merge pull request #6260 from cli/fix-branch-delete
Fix deleting remote branches with `#` in their name
This commit is contained in:
commit
cfb7e66d2b
6 changed files with 38 additions and 29 deletions
|
|
@ -133,7 +133,7 @@ func TestDisableRun(t *testing.T) {
|
|||
tty: true,
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/a workflow"),
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/a%20workflow"),
|
||||
httpmock.StatusStringResponse(404, "not found"))
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows"),
|
||||
|
|
@ -158,7 +158,7 @@ func TestDisableRun(t *testing.T) {
|
|||
tty: true,
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/another workflow"),
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/another%20workflow"),
|
||||
httpmock.StatusStringResponse(404, "not found"))
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows"),
|
||||
|
|
@ -217,7 +217,7 @@ func TestDisableRun(t *testing.T) {
|
|||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/a workflow"),
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/a%20workflow"),
|
||||
httpmock.StatusStringResponse(404, "not found"))
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows"),
|
||||
|
|
@ -242,7 +242,7 @@ func TestDisableRun(t *testing.T) {
|
|||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/another workflow"),
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/another%20workflow"),
|
||||
httpmock.StatusStringResponse(404, "not found"))
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows"),
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ func TestEnableRun(t *testing.T) {
|
|||
tty: true,
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/terrible workflow"),
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/terrible%20workflow"),
|
||||
httpmock.StatusStringResponse(404, "not found"))
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows"),
|
||||
|
|
@ -159,7 +159,7 @@ func TestEnableRun(t *testing.T) {
|
|||
tty: true,
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/a disabled workflow"),
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/a%20disabled%20workflow"),
|
||||
httpmock.StatusStringResponse(404, "not found"))
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows"),
|
||||
|
|
@ -188,7 +188,7 @@ func TestEnableRun(t *testing.T) {
|
|||
tty: true,
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/a disabled inactivity workflow"),
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/a%20disabled%20inactivity%20workflow"),
|
||||
httpmock.StatusStringResponse(404, "not found"))
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows"),
|
||||
|
|
@ -243,7 +243,7 @@ func TestEnableRun(t *testing.T) {
|
|||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/terrible workflow"),
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/terrible%20workflow"),
|
||||
httpmock.StatusStringResponse(404, "not found"))
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows"),
|
||||
|
|
@ -268,7 +268,7 @@ func TestEnableRun(t *testing.T) {
|
|||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/a disabled inactivity workflow"),
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/a%20disabled%20inactivity%20workflow"),
|
||||
httpmock.StatusStringResponse(404, "not found"))
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows"),
|
||||
|
|
@ -292,7 +292,7 @@ func TestEnableRun(t *testing.T) {
|
|||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/a disabled workflow"),
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/a%20disabled%20workflow"),
|
||||
httpmock.StatusStringResponse(404, "not found"))
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows"),
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ func getWorkflowByID(client *api.Client, repo ghrepo.Interface, ID string) (*Wor
|
|||
var workflow Workflow
|
||||
|
||||
err := client.REST(repo.RepoHost(), "GET",
|
||||
fmt.Sprintf("repos/%s/actions/workflows/%s", ghrepo.FullName(repo), ID),
|
||||
fmt.Sprintf("repos/%s/actions/workflows/%s", ghrepo.FullName(repo), url.PathEscape(ID)),
|
||||
nil, &workflow)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ func REST(method, p string) Matcher {
|
|||
if !strings.EqualFold(req.Method, method) {
|
||||
return false
|
||||
}
|
||||
return req.URL.Path == "/"+p
|
||||
return req.URL.EscapedPath() == "/"+p
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue