зеркало из https://github.com/mislav/hub.git
Fix `release` from detached HEAD
Don't try to default `target_commitish` to the currently checked out branch. Instead, keep the value blank unless explicitly provided. It will default to the main branch on the server.
This commit is contained in:
Родитель
5b5dc6ee13
Коммит
d5c8337f1f
|
@ -73,7 +73,8 @@ With '--include-drafts', include draft releases in the listing.
|
|||
Further edit the contents of <FILE> in a text editor before submitting.
|
||||
|
||||
-c, --commitish <TARGET>
|
||||
A SHA, tag, or branch name to attach the release to (default: current branch).
|
||||
A commit SHA or branch name to attach the release to, only used if <TAG>
|
||||
doesn't already exist (default: main branch).
|
||||
|
||||
<TAG>
|
||||
The git tag name for this release.
|
||||
|
@ -272,13 +273,6 @@ func createRelease(cmd *Command, args *Args) {
|
|||
|
||||
gh := github.NewClient(project.Host)
|
||||
|
||||
commitish := flagReleaseCommitish
|
||||
if commitish == "" {
|
||||
currentBranch, err := localRepo.CurrentBranch()
|
||||
utils.Check(err)
|
||||
commitish = currentBranch.ShortName()
|
||||
}
|
||||
|
||||
var title string
|
||||
var body string
|
||||
var editor *github.Editor
|
||||
|
@ -290,7 +284,7 @@ func createRelease(cmd *Command, args *Args) {
|
|||
utils.Check(err)
|
||||
} else {
|
||||
cs := git.CommentChar()
|
||||
message, err := renderReleaseTpl("Creating", cs, tagName, project.String(), commitish)
|
||||
message, err := renderReleaseTpl("Creating", cs, tagName, project.String(), flagReleaseCommitish)
|
||||
utils.Check(err)
|
||||
|
||||
editor, err := github.NewEditor("RELEASE", "release", message)
|
||||
|
@ -306,7 +300,7 @@ func createRelease(cmd *Command, args *Args) {
|
|||
|
||||
params := &github.Release{
|
||||
TagName: tagName,
|
||||
TargetCommitish: commitish,
|
||||
TargetCommitish: flagReleaseCommitish,
|
||||
Name: title,
|
||||
Body: body,
|
||||
Draft: flagReleaseDraft,
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
)
|
||||
|
||||
const releaseTmpl = `
|
||||
{{.CS}} {{.Operation}} release {{.TagName}} for {{.ProjectName}} from {{.BranchName}}
|
||||
{{.CS}} {{.Operation}} release {{.TagName}} for {{.ProjectName}}{{if .BranchName}} from {{.BranchName}}{{end}}
|
||||
{{.CS}}
|
||||
{{.CS}} Write a message for this release. The first block of
|
||||
{{.CS}} text is the title and the rest is the description.`
|
||||
|
|
|
@ -181,7 +181,7 @@ MARKDOWN
|
|||
post('/repos/mislav/will_paginate/releases') {
|
||||
assert :draft => true,
|
||||
:tag_name => "v1.2.0",
|
||||
:target_commitish => "master",
|
||||
:target_commitish => "",
|
||||
:name => "will_paginate 1.2.0: Instant Gratification Monkey",
|
||||
:body => ""
|
||||
|
||||
|
@ -195,6 +195,23 @@ MARKDOWN
|
|||
https://github.com/mislav/will_paginate/releases/v1.2.0\n
|
||||
"""
|
||||
|
||||
Scenario: Create a release with target commitish
|
||||
Given the GitHub API server:
|
||||
"""
|
||||
post('/repos/mislav/will_paginate/releases') {
|
||||
assert :tag_name => "v1.2.0",
|
||||
:target_commitish => "my-branch"
|
||||
|
||||
status 201
|
||||
json :html_url => "https://github.com/mislav/will_paginate/releases/v1.2.0"
|
||||
}
|
||||
"""
|
||||
When I successfully run `hub release create -m hello v1.2.0 -c my-branch`
|
||||
Then the output should contain exactly:
|
||||
"""
|
||||
https://github.com/mislav/will_paginate/releases/v1.2.0\n
|
||||
"""
|
||||
|
||||
Scenario: Create a release with assets
|
||||
Given the GitHub API server:
|
||||
"""
|
||||
|
|
Загрузка…
Ссылка в новой задаче